/* ---------- Match-source badges (in heading / in quote) ---- */
/* Inline pill shown in case-card paragraph hits when the FTS match
 * landed in a heading or quote nested inside the logical paragraph,
 * rather than the body text itself.  Helps the researcher tell apart
 * "matched in the section title 'I. JUDICIAL INDEPENDENCE'" from
 * "matched in the body of ¶ 184". */

.match-source-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2px;
  vertical-align: middle;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.match-source-heading {
  background: rgba(76, 114, 176, 0.12);
  color: #2c5282;
  border: 1px solid rgba(76, 114, 176, 0.25);
}

.match-source-quote {
  background: rgba(184, 134, 11, 0.10);
  color: #92400e;
  border: 1px solid rgba(184, 134, 11, 0.22);
}

.match-source-operative {
  background: rgba(85, 168, 104, 0.10);
  color: #2f7a4d;
  border: 1px solid rgba(85, 168, 104, 0.22);
}

[data-theme="dark"] .match-source-heading {
  background: rgba(140, 165, 215, 0.18);
  color: #b7d1ff;
}
[data-theme="dark"] .match-source-quote {
  background: rgba(218, 178, 100, 0.16);
  color: #f2c97a;
}
[data-theme="dark"] .match-source-operative {
  background: rgba(120, 200, 145, 0.18);
  color: #b3edcb;
}


/* ---------- Search scope bar (sits under search input) ----- */
/* Two opt-in toggles let the user expand the default BODY search to
 * include Separate Opinions and/or Header/Summary/Appendix.  The
 * underlying logic lives in search-app.js (getCurrentFilters + the
 * serverSearch._buildParams scope branch). */

.search-scope-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.search-scope-bar .scope-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.search-scope-bar .scope-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 11px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.search-scope-bar .scope-chip-default {
  background: rgba(76, 114, 176, 0.08);
  border-color: rgba(76, 114, 176, 0.25);
  color: var(--text-primary);
}

.search-scope-bar .scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 3px 8px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.search-scope-bar .scope-toggle:hover {
  background: rgba(0, 0, 0, 0.025);
  border-color: var(--border);
}

[data-theme="dark"] .search-scope-bar .scope-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.search-scope-bar .scope-toggle input {
  margin: 0;
  cursor: pointer;
}

.search-scope-bar .scope-toggle:has(input:checked) {
  background: rgba(76, 114, 176, 0.10);
  border-color: rgba(76, 114, 176, 0.30);
  color: var(--text-primary);
}

/* ---------- v1 bucket pills ------------------------------- */
.bucket-scope .bucket-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 4px 11px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.bucket-scope .bucket-pill input {
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent, #4C72B0);
}

.bucket-scope .bucket-pill:hover {
  background: rgba(0, 0, 0, 0.025);
  border-color: var(--border-strong, #999);
}

[data-theme="dark"] .bucket-scope .bucket-pill:hover {
  background: rgba(255, 255, 255, 0.04);
}

.bucket-scope .bucket-pill:has(input:checked) {
  background: rgba(76, 114, 176, 0.12);
  border-color: rgba(76, 114, 176, 0.40);
  color: var(--text-primary);
  font-weight: 600;
}

/* Color each bucket pill when checked, mirroring SECTION_BUCKETS */
.bucket-scope .bucket-pill:has(input[value="facts"]:checked) {
  background: rgba(221, 132, 82, 0.12);
  border-color: rgba(221, 132, 82, 0.40);
}
.bucket-scope .bucket-pill:has(input[value="adm_merits"]:checked) {
  background: rgba(85, 168, 104, 0.12);
  border-color: rgba(85, 168, 104, 0.40);
}
.bucket-scope .bucket-pill:has(input[value="just_satisfaction"]:checked) {
  background: rgba(218, 139, 195, 0.12);
  border-color: rgba(218, 139, 195, 0.40);
}
.bucket-scope .bucket-pill:has(input[value="operative_part"]:checked) {
  background: rgba(100, 181, 205, 0.12);
  border-color: rgba(100, 181, 205, 0.40);
}
.bucket-scope .bucket-pill:has(input[value="individual_opinions"]:checked) {
  background: rgba(140, 140, 140, 0.12);
  border-color: rgba(140, 140, 140, 0.40);
}

.bucket-scope .scope-divider {
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 2px;
}

/* Per-paragraph action row (HUDOC ¶ link, Cite, Copy) */
.paragraph-item .para-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.paragraph-item .para-actions a,
.paragraph-item .para-actions button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.paragraph-item .para-actions a:hover,
.paragraph-item .para-actions button:hover {
  background: rgba(76, 114, 176, 0.08);
  border-color: rgba(76, 114, 176, 0.30);
  color: var(--text-primary);
}

.paragraph-item .para-actions .hudoc-para-link {
  color: var(--accent-link, #4C72B0);
}

/* v1.1 bullet group: consecutive quote/operative hits in same section. */
.paragraph-group {
  border-left: 3px solid rgba(140, 116, 100, 0.45);
  padding-left: 12px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.012);
  border-radius: 0 6px 6px 0;
}

[data-theme="dark"] .paragraph-group {
  background: rgba(255, 255, 255, 0.025);
  border-left-color: rgba(189, 165, 145, 0.45);
}

.paragraph-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 6px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.paragraph-group-count {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.paragraph-group-body .paragraph-item.grouped-item {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--border);
}

.paragraph-group-body .paragraph-item.grouped-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.paragraph-group-body .paragraph-item.grouped-item .para-header {
  /* grouped items don't repeat the section badge — header is at group level */
  padding-bottom: 2px;
}


/* ============================================================
 * judgment-hudoc.css
 * ------------------------------------------------------------
 * HUDOC-style visual overlay for the "Open judgment" modal.
 *
 * Loaded AFTER search-app.css so its rules override the defaults
 * without touching the base file.  No JS changes, no data
 * changes — pure typography + layout to make the in-app
 * judgment viewer feel familiar to anyone coming from
 * hudoc.echr.coe.int.
 *
 * Affects ONLY rules under `.modal*` selectors.  Safe to remove
 * by unlinking the stylesheet from index.html.
 * ============================================================ */


/* ---------- 1. Panel: wider, page-like canvas -------------- */

.modal-panel {
  width: min(1100px, calc(100% - 32px));
}

.modal-body {
  padding: 32px 0 48px;
  background: var(--bg-card);
}


/* ---------- 2. Header: centered, court-like preamble ------- */

.modal-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 56px 10px;
  border-bottom: none;
  gap: 4px;
  position: relative;
}

.modal-header::before {
  content: 'EUROPEAN COURT OF HUMAN RIGHTS';
  display: block;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.4;
  max-width: 720px;
  margin: 0 auto;
  color: var(--text-primary);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
}


/* ---------- 3. Meta strip: centered serif ------------------ */

.modal-meta {
  text-align: center;
  padding: 4px 56px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.modal-meta a {
  color: var(--primary-accent, #3182ce);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.modal-meta a:hover {
  border-bottom-style: solid;
}


/* ---------- 4. Tools bar: tighter, narrower -------------- */

.modal-tools {
  padding: 12px 56px;
}


/* ---------- 5. Sections: centered HUDOC-style headers ----- */

.modal-section {
  max-width: 760px;
  margin: 0 auto 28px;
  padding: 0 56px;
}

.modal-section h3 {
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1.8px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 38px 0 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-section h3::before,
.modal-section h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  opacity: 0.7;
}

[data-theme="dark"] .modal-section h3 {
  background: transparent;
  color: var(--text-primary);
}


/* ---------- 6. Paragraphs: serif body, hanging ¶ number --- */

.modal-para {
  display: block;
  position: relative;
  margin: 0 0 0.85em;
  padding: 0.2em 0 0.2em 3.4em;     /* 3.4em reserved for ¶ N column */
  border-radius: 3px;
  line-height: 1.75;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-primary);
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  transition: background 0.15s;
  border-bottom: none;
}

.modal-para > .modal-para-num {
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 2.9em;
  display: inline-block;
  text-align: right;
  font-family: var(--font-serif);
  font-size: 0.92em;
  font-weight: 600;
  color: var(--text-secondary);
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  user-select: none;
}

.modal-para:hover {
  background: rgba(0, 0, 0, 0.025);
}

[data-theme="dark"] .modal-para:hover {
  background: rgba(255, 255, 255, 0.03);
}

.modal-para.visible-hit {
  background: rgba(254, 240, 138, 0.28);
  border-left: 3px solid #eab308;
  padding-left: calc(3.4em - 3px);
}


/* ---------- 7. Continuation / quoted blocks ---------------- */
/* HUDOC renders embedded statutory quotations indented from the
 * main column with a thin left rule, smaller upright serif —
 * not italic (that contradicts HUDOC's default house style). */

.modal-para-continuation {
  display: block;
  position: relative;
  margin: 0.35em 0 0.45em 3.4em;        /* aligns with body text */
  padding: 0.35em 0 0.35em 1.6em;
  border-left: 3px solid var(--primary-accent, #3182ce);
  background: rgba(49, 130, 206, 0.04);
  font-family: var(--font-serif);
  font-size: 0.93rem;
  line-height: 1.7;
  font-style: normal;
  color: var(--text-primary);
  text-align: justify;
  hyphens: auto;
}

/* Group consecutive .modal-para-continuation rows into one visual block:
 * remove top margin / shared border seam so multi-row HUDOC quote blocks
 * (which often span 5-15 rows of cited statutes or expert reports) read
 * as a single indented quote, not a stack of mini-quotes. */
.modal-para-continuation + .modal-para-continuation {
  margin-top: 0;
  padding-top: 0.1em;
}

[data-theme="dark"] .modal-para-continuation {
  background: rgba(140, 175, 230, 0.06);
  border-left-color: #7aa6e8;
  color: var(--text-primary);
}

.modal-para-continuation > .modal-para-num {
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 2.4em;
  font-size: 0.78em;
  font-style: normal;
  font-weight: 500;
  opacity: 0.5;
  color: var(--text-muted);
  text-align: right;
}


/* ---------- 8. Sub-headings (A., I., "The applicant") ---- */

.modal-para-heading {
  margin: 1.4em 0 0.55em;
  padding: 0;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
}

[data-theme="dark"] .modal-para-heading {
  color: var(--text-primary);
}

/* Heading hierarchy: P34 emits row_role="heading_h<N>" derived from the
 * Ju_H_* style.  CSS overrides .modal-para-heading per level so the
 * document outline is visually reconstructable from the rendered modal.
 *
 *   h0 — section top-level (PROCEDURE / THE FACTS / THE LAW)
 *   h1 — Roman numerals    (I., II., III.)
 *   h2 — Letters           (A., B., C.)
 *   h3 — Arabic numbers    (1., 2., 3.)
 *   h4 — Letters in parens ((a), (b), (c))
 */

.modal-para-heading_h0 {
  margin: 2em 0 1em;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  text-align: center;
}

.modal-para-heading_h1 {
  margin: 1.6em 0 0.7em;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: center;
}

.modal-para-heading_h2 {
  margin: 1.4em 0 0.5em;
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  font-style: normal;
  text-align: left;
  padding-left: 0;
}

.modal-para-heading_h3 {
  margin: 1.1em 0 0.4em 0.8em;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 600;
  font-style: italic;
}

.modal-para-heading_h4 {
  margin: 0.9em 0 0.4em 1.8em;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 500;
  font-style: italic;
  color: var(--text-secondary);
}


/* ---------- 9. Operative part: distinct treatment ---------- */
/* HUDOC sets "FOR THESE REASONS, THE COURT" apart visually —
 * larger header letter-spacing and a soft background tint to
 * pull the eye. */

.modal-section[data-section="operative_part"] {
  margin-top: 48px;
  padding-top: 22px;
  padding-bottom: 28px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(0, 0, 0, 0.012) 60px
  );
  border-radius: 6px;
}

[data-theme="dark"] .modal-section[data-section="operative_part"] {
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.02) 60px
  );
}

.modal-section[data-section="operative_part"] h3 {
  margin-top: 0;
  font-size: 0.98rem;
  letter-spacing: 2.2px;
}

.modal-section[data-section="operative_part"] .modal-para {
  margin-bottom: 1em;
}

/* Operative clauses — HUDOC-style numbered ruling list:
 *   1.  Declares, by a majority, the complaint admissible;
 *   2.  Holds, by sixteen votes to one, that there has been...
 *   5.  Holds, by sixteen votes to one,
 *      a.  that the respondent State is to pay...
 *      b.  that from the expiry of the above-mentioned...
 *   6.  Dismisses, by fifteen votes to two, the remainder...
 *
 * Numbering rendered via CSS counters scoped to the operative
 * section.  Sub-clauses (rows starting with "that " lowercase
 * or "(a)/(b)/(c)") are tagged by JS with .modal-para-operative-sub
 * and rendered with letter-list (a, b, c) indented one level deeper.
 * Main clauses get italic first word (the verb) via <em> wrap from JS.
 */
.modal-section[data-section="operative_part"] {
  counter-reset: op-clause op-subclause;
}

.modal-para-operative_list {
  display: block;
  position: relative;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.75;
  margin: 0 0 0.8em 0;
  padding-left: 3.2em;
  color: var(--text-primary);
  text-align: justify;
  hyphens: auto;
  text-transform: none;
  letter-spacing: 0;
}

.modal-para-operative-main::before {
  counter-increment: op-clause;
  counter-set: op-subclause 0;
  content: counter(op-clause) ".";
  position: absolute;
  left: 0;
  top: 0;
  width: 2.4em;
  text-align: right;
  padding-right: 0.6em;
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: normal;
  color: var(--text-primary);
}

.modal-para-operative-sub {
  margin-left: 1.6em;
  padding-left: 3.2em;
  margin-top: 0.2em;
}

.modal-para-operative-sub::before {
  counter-increment: op-subclause;
  content: counter(op-subclause, lower-alpha) ".";
  position: absolute;
  left: 0;
  top: 0;
  width: 2.4em;
  text-align: right;
  padding-right: 0.6em;
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  color: var(--text-primary);
}

.modal-para-operative_list em {
  font-style: italic;
  font-weight: 400;
}


/* ---------- 10. Signature & footer rows ------------------- */

.modal-para-signature {
  text-align: right;
  font-style: italic;
  font-family: var(--font-serif);
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin: 1.4em 0 0.6em;
  padding-right: 1em;
  letter-spacing: 0;
  text-transform: none;
}

.modal-para-footer {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 1.6em 0;
  letter-spacing: 0;
  text-transform: none;
}

.modal-para-metadata {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0.8em 0;
  letter-spacing: 0;
  text-transform: none;
}


/* ---------- 11. Separate opinions: clear break ------------ */

.modal-section[data-section="separate_opinion"] {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 1px dashed var(--border);
}

.modal-section[data-section="separate_opinion"] h3 {
  font-style: italic;
  font-weight: 700;
  letter-spacing: 1.6px;
}


/* ---------- 11b. Summary section (bordered keyword box) ---- */
/* HUDOC publishes a one-paragraph "keyword summary" of each modern
 * judgment, framed in a thin black border at the top of the document
 * (just after the JUDGMENT title, before the judges' composition).
 * Reproduce that bordered look so summaries don't visually mix with
 * regular body paragraphs. */

.modal-section[data-section="summary"] {
  margin-top: 0;
  margin-bottom: 28px;
  padding: 0 56px;
}

.modal-section[data-section="summary"] h3 {
  display: none;          /* HUDOC has no "SUMMARY" label — the box does the framing */
}

.modal-section[data-section="summary"] .modal-para {
  display: block;
  position: relative;
  border: 1px solid var(--border);
  padding: 12px 18px;
  margin: 0 0 0.4em;
  font-family: var(--font-serif);
  font-size: 0.92rem;
  line-height: 1.65;
  text-align: justify;
  hyphens: auto;
  color: var(--text-primary);
  background: transparent;
}

/* Consecutive summary rows: collapse vertical seams so the block
 * reads as one box (top border on first, bottom on last, single
 * 1px between).  Achieved via :first-of-type / :last-of-type. */
.modal-section[data-section="summary"] .modal-para + .modal-para {
  border-top: none;
  margin-top: 0;
}

.modal-section[data-section="summary"] .modal-para .modal-para-num {
  display: none;          /* no ¶ N marker on summary bullets */
}

.modal-section[data-section="summary"] .modal-para:hover {
  background: rgba(0,0,0,0.015);
}

[data-theme="dark"] .modal-section[data-section="summary"] .modal-para:hover {
  background: rgba(255,255,255,0.02);
}


/* ---------- 12. Header section (metadata block) ----------- */
/* HUDOC preamble: "FIFTH SECTION", "CASE OF X v. Y", "(Application
 * no. NNNN/YY)", "JUDGMENT", "STRASBOURG", date.  Each line is
 * centered and styled differently in HUDOC's house style:
 *   FIFTH SECTION           — uppercase, normal weight serif
 *   CASE OF X v. Y          — BOLD (not italic)
 *   (Application no. ...)   — italic
 *   JUDGMENT                — normal, slightly larger
 *   STRASBOURG / date       — normal
 *   "This judgment is final" footer — italic
 *
 * Our default `.modal-para-heading` rule sets italic for ALL
 * heading-like rows, which conflicts.  Override here to plain
 * normal weight, then use :nth-child rules to pick out the
 * specific lines that need bold / italic. */

.modal-section[data-section="header"] {
  margin-top: 8px;
  margin-bottom: 38px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.modal-section[data-section="header"] h3 {
  display: none;
}

.modal-section[data-section="header"] .modal-para,
.modal-section[data-section="header"] .modal-para-heading {
  text-align: center;
  font-family: var(--font-serif);
  padding-left: 0;
  margin: 0.35em 0;
  font-style: normal;        /* override .modal-para-heading italic */
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Specific lines (positionally) */
.modal-section[data-section="header"] .modal-para-heading:nth-of-type(1),
.modal-section[data-section="header"] .modal-para:nth-of-type(1) {
  /* Section banner like "FIFTH SECTION" */
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-size: 0.95rem;
}

.modal-section[data-section="header"] .modal-para-heading:nth-of-type(2),
.modal-section[data-section="header"] .modal-para:nth-of-type(2) {
  /* Case name "CASE OF X v. Y" — BOLD, not italic */
  font-weight: 700;
  font-size: 1.08rem;
  margin-top: 1.2em;
}

.modal-section[data-section="header"] .modal-para-heading:nth-of-type(3),
.modal-section[data-section="header"] .modal-para:nth-of-type(3) {
  /* "(Application no. ...)" — italic */
  font-style: italic;
}

.modal-section[data-section="header"] .modal-para-heading:nth-of-type(4),
.modal-section[data-section="header"] .modal-para:nth-of-type(4) {
  /* "JUDGMENT" or similar — normal, slight emphasis */
  margin-top: 1.6em;
  font-size: 1.0rem;
}

.modal-section[data-section="header"] .modal-para-heading:nth-of-type(5),
.modal-section[data-section="header"] .modal-para:nth-of-type(5),
.modal-section[data-section="header"] .modal-para-heading:nth-of-type(6),
.modal-section[data-section="header"] .modal-para:nth-of-type(6) {
  /* STRASBOURG, date */
  font-size: 0.95rem;
  margin: 0.2em 0;
}

.modal-section[data-section="header"] .modal-para > .modal-para-num {
  display: none;
}


/* ---------- 12b. Inter-section vertical spacing (HUDOC page-breaks) -- */
/* HUDOC originals use `page-break-before:always` on major section
 * headers so each major section starts on its own page.  We replicate
 * the visual effect with generous top-margin on the relevant chunks,
 * giving the reader a clear breath between THE FACTS / THE LAW /
 * FOR THESE REASONS / SEPARATE OPINIONS. */

.modal-section + .modal-section {
  margin-top: 2.2em;
}

.modal-section[data-section="operative_part"],
.modal-section[data-section="separate_opinion"] {
  margin-top: 3.4em;
}


/* ---------- 12d. HUDOC-style table (Appendix / annex) ----------- */
/* When the modal renderer detects consecutive `table_id`-tagged
 * cell rows, it groups them into a single <table class="modal-table">.
 * First row gets <th>, the rest <td>.  Style to match HUDOC's
 * appendix tables: thin borders, header row tinted, compact font. */

/* Tables can have 8-12 columns (HUDOC appendix template) — too tight
 * for the 760px modal column.  Use horizontal scroll + per-cell
 * min-width so columns stay readable instead of word-splitting
 * mid-word ("Harm aniuc Valeri u").  Wrap container lets the table
 * exceed the section's content column. */
.modal-table-wrap {
  margin: 1.2em -56px;       /* break out of section's 56px padding */
  padding: 0 16px;
  overflow-x: auto;
}

.modal-table {
  border-collapse: collapse;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  line-height: 1.45;
  border: 1px solid var(--border);
  background: var(--bg-card);
  table-layout: auto;
}

.modal-table th,
.modal-table td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  vertical-align: top;
  text-align: left;
  word-break: normal;
  overflow-wrap: break-word;
  min-width: 110px;
  max-width: 260px;
}

.modal-table th {
  background: rgba(0, 0, 0, 0.025);
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
}

[data-theme="dark"] .modal-table th {
  background: rgba(255, 255, 255, 0.04);
}

.modal-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.012);
}

[data-theme="dark"] .modal-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}


/* ---------- 12c. Appendix section (multi-applicant table) ------- */
/* HUDOC publishes multi-applicant cases (and a few single-applicant
 * decisions) with an Appendix containing a tabular list of applicants
 * + their procedural details.  P34 reads each table cell as a
 * separate visible paragraph, so when we render the section we get a
 * long stack of one-line cells.  Compact the layout so it reads as
 * a tighter data block instead of dozens of "¶ —" lines. */

.modal-section[data-section="appendix"] {
  margin-top: 3.4em;
}

.modal-section[data-section="appendix"] .modal-para {
  margin: 0 0 0.15em;
  padding: 0.1em 0.5em;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: left;
  hyphens: none;
}

.modal-section[data-section="appendix"] .modal-para > .modal-para-num {
  display: none;             /* hide "¶ —" markers — appendix cells aren't paragraphs */
}

.modal-section[data-section="appendix"] .modal-para-heading {
  margin: 0.9em 0 0.3em;
  font-size: 0.92rem;
  font-style: normal;
  font-weight: 600;
}


/* ---------- 13. Highlighted search hits within judgment --- */

.modal-para mark,
.modal-para-continuation mark {
  background: rgba(254, 240, 138, 0.55);
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}


/* ---------- 13b. Inline HUDOC references (application numbers) -- */
/* Detect "N/Y" application-number patterns in paragraph text and
 * render them as in-app links.  JS handler in search-app.js
 * intercepts the click, runs `case:N/Y` search, opens the first hit
 * in the modal. */

.modal-para .ref-link,
.modal-para-continuation .ref-link {
  color: var(--primary-accent, #3182ce);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-bottom-style 0.1s;
}

.modal-para .ref-link:hover,
.modal-para-continuation .ref-link:hover {
  border-bottom-style: solid;
  background: rgba(49, 130, 206, 0.05);
}

[data-theme="dark"] .modal-para .ref-link {
  color: #8ab4f8;
}


/* ---------- 14. Responsive: narrow screens ---------------- */

@media (max-width: 820px) {
  .modal-header,
  .modal-meta,
  .modal-tools,
  .modal-section {
    padding-left: 20px;
    padding-right: 20px;
  }
  .modal-header h2 {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
  }
  .modal-para {
    padding-left: 2.6em;
    text-align: left;            /* drop justify on narrow */
    hyphens: none;
  }
  .modal-para > .modal-para-num {
    width: 2.2em;
  }
  .modal-para-continuation {
    margin-left: 2em;
    padding-left: 1.6em;
  }
}
