/* =============================================================================
   OBSERVATORIO JUDICIAL — editorial / case-file aesthetic
   ----------------------------------------------------------------------------- */

:root {
  --paper:       #f2efe8;
  --paper-edge:  #e8e2d5;
  --ink:         #1a1611;
  --ink-soft:    #3a342b;
  --sepia:       #6b6052;
  --oxblood:     #8e2a1f;
  --oxblood-dim: #6b1f17;
  --gold:        #a67c2d;

  --rule:        #1a1611;
  --rule-soft:   rgba(26, 22, 17, 0.18);

  --serif-display: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --serif-body:    'Newsreader', 'EB Garamond', Georgia, serif;
  --mono:          'IBM Plex Mono', ui-monospace, monospace;

  --content-w: 760px;
  --margin-w: 96px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(166, 124, 45, 0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(142, 42, 31, 0.05), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "onum";
}

/* paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.09  0 0 0 0 0.07  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.paper {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 88px 56px 64px;
  z-index: 2;
}

/* =============================================================================
   MASTHEAD
   ----------------------------------------------------------------------------- */

.masthead { margin-bottom: 64px; }

.masthead__edition {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sepia);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 8px 0 6px;
}

.kicker { padding-left: 2px; }
.folio  { font-feature-settings: "tnum"; }

.masthead__title {
  font-family: var(--serif-display);
  font-weight: 350;
  font-size: clamp(56px, 9vw, 124px);
  line-height: 0.92;
  letter-spacing: -0.025em;
  margin: 28px 0 32px;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  font-style: italic;
  color: var(--ink);
}

.title-line { display: block; }
.title-line--alt {
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variation-settings: "opsz" 144, "SOFT" 0;
  text-indent: 0.25em;
}

.masthead__rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 24px 0 28px;
}
.masthead__rule span:first-child,
.masthead__rule span:last-child {
  height: 1px;
  background: var(--ink);
}
.masthead__rule .diamond {
  font-size: 12px;
  color: var(--oxblood);
  letter-spacing: 0.5em;
  padding-left: 0.5em;
}

.standfirst {
  font-family: var(--serif-body);
  font-size: 21px;
  line-height: 1.55;
  font-weight: 320;
  max-width: var(--content-w);
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-variation-settings: "opsz" 36;
}
.standfirst em {
  font-style: italic;
  font-variation-settings: "opsz" 36;
}

.masthead__byline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sepia);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.masthead__byline .dot { color: var(--oxblood); }

/* =============================================================================
   LEDE / KPIs
   ----------------------------------------------------------------------------- */

.lede {
  margin: 0 0 64px;
  border-top: 6px double var(--ink);
  border-bottom: 6px double var(--ink);
  padding: 32px 0 28px;
}

.lede__numerals {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 4px;
}

.lede__numerals article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
}

.num {
  font-family: var(--serif-display);
  font-weight: 300;
  font-size: clamp(56px, 7vw, 96px);
  line-height: 0.85;
  font-variation-settings: "opsz" 144;
  font-feature-settings: "tnum", "lnum";
  color: var(--ink);
  letter-spacing: -0.04em;
}

.num-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sepia);
  margin-top: 8px;
}

.lede__sep {
  font-family: var(--serif-display);
  font-size: 64px;
  font-weight: 200;
  color: var(--oxblood);
  align-self: center;
  font-style: italic;
  padding: 0 4px 16px;
}

.lede__range {
  margin: 28px 0 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sepia);
}
.lede__range strong { color: var(--ink); font-weight: 500; }

/* =============================================================================
   CHAPTERS
   ----------------------------------------------------------------------------- */

.chapter {
  display: grid;
  grid-template-columns: var(--margin-w) 1fr;
  gap: 32px;
  margin: 72px 0;
}

.margin {
  position: relative;
  border-right: 1px solid var(--rule-soft);
  padding-top: 4px;
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sepia);
}

.section-num {
  display: block;
  color: var(--oxblood);
  font-weight: 500;
}

.section-roman {
  display: block;
  font-family: var(--serif-display);
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin-top: 12px;
  font-variation-settings: "opsz" 144;
}

.chapter__content {
  max-width: var(--content-w);
}

.chapter__eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin-bottom: 14px;
}

.chapter__heading {
  font-family: var(--serif-display);
  font-weight: 380;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 30;
}

.chapter__lede {
  font-family: var(--serif-body);
  font-size: 19px;
  line-height: 1.55;
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-variation-settings: "opsz" 36;
}

.dropcap {
  float: left;
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: 76px;
  line-height: 0.78;
  margin: 6px 12px 0 0;
  color: var(--oxblood);
  font-variation-settings: "opsz" 144, "SOFT" 0;
  font-style: italic;
}

/* =============================================================================
   FIGURES & CHARTS
   ----------------------------------------------------------------------------- */

.figure {
  margin: 32px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 24px 0 16px;
}

.figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.figure figcaption {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sepia);
}

.parties-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.figure--half { padding-bottom: 8px; }

@media (max-width: 720px) {
  .parties-grid { grid-template-columns: 1fr; }
}

/* SVG chart classes */
.bar             { fill: var(--ink); transition: fill 200ms ease; }
.bar--accent     { fill: var(--oxblood); }
.bar:hover       { fill: var(--oxblood); }

.bar-label,
.axis-label,
.value-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  fill: var(--ink);
}

.value-label { font-weight: 500; fill: var(--ink); }
.axis-label  { fill: var(--sepia); text-transform: uppercase; letter-spacing: 0.18em; }

.axis-line { stroke: var(--ink); stroke-width: 1; }
.tick-line { stroke: var(--rule-soft); stroke-width: 1; }

.donut-segment { stroke: var(--paper); stroke-width: 2; }
.donut-label   { font-family: var(--mono); font-size: 10.5px; fill: var(--ink); letter-spacing: 0.04em; }
.donut-value   { font-family: var(--serif-display); font-size: 22px; fill: var(--ink); font-weight: 400; font-variation-settings: "opsz" 144; }

/* =============================================================================
   PROVINCE LIST — registry-styled
   ----------------------------------------------------------------------------- */

.province-list {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 8px 0;
}

.province-row {
  display: grid;
  grid-template-columns: 32px 1fr 100px 64px;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--serif-body);
  font-size: 18px;
}
.province-row:last-child { border-bottom: 0; }

.province-row .rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--sepia);
  letter-spacing: 0.1em;
}
.province-row .name { font-weight: 500; color: var(--ink); }

.province-row .meter {
  height: 10px;
  background: var(--paper-edge);
  border: 1px solid var(--ink);
  position: relative;
  overflow: hidden;
}
.province-row .meter span {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--ink),
    var(--ink) 2px,
    transparent 2px,
    transparent 4px
  );
}
.province-row:nth-child(1) .meter span,
.province-row:nth-child(2) .meter span {
  background: var(--oxblood);
}

.province-row .count {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  font-feature-settings: "tnum";
}

/* =============================================================================
   REGISTRY (table)
   ----------------------------------------------------------------------------- */

.registry {
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-family: var(--serif-body);
  font-size: 15px;
}

.registry th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sepia);
  padding: 12px 10px;
  border-bottom: 1px solid var(--ink);
  font-weight: 400;
}

.registry .reg-num   { width: 44px; text-align: center; }
.registry .reg-count { width: 80px; text-align: right; }

.registry td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.registry tr:last-child td { border-bottom: 0; }
.registry tr:hover { background: rgba(166, 124, 45, 0.06); }

.registry td:nth-child(1),
.registry td:nth-child(4) {
  font-family: var(--mono);
  font-feature-settings: "tnum";
  font-size: 13px;
  color: var(--sepia);
}
.registry td:nth-child(4) { color: var(--ink); font-weight: 500; text-align: right; }
.registry td:nth-child(3) { color: var(--sepia); font-style: italic; }

/* =============================================================================
   RULES & DIVIDERS
   ----------------------------------------------------------------------------- */

.rule {
  height: 1px;
  background: var(--ink);
  margin: 56px 0;
}
.rule--bold {
  height: 4px;
  background: none;
  border-top: 1px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}

/* =============================================================================
   COLOPHON
   ----------------------------------------------------------------------------- */

.colophon {
  margin-top: 56px;
  text-align: center;
  font-family: var(--serif-body);
  font-size: 14px;
  color: var(--sepia);
  font-style: italic;
  font-variation-settings: "opsz" 36;
}

.colophon a {
  color: var(--oxblood);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.colophon__rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}
.colophon__rule span:first-child,
.colophon__rule span:last-child {
  height: 1px;
  background: var(--rule-soft);
}
.colophon__rule .ornament {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.5em;
  padding-left: 0.5em;
}

.colophon__signoff {
  margin-top: 16px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
}

/* =============================================================================
   ENTRANCE — staggered reveal
   ----------------------------------------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.masthead                  { animation: rise 700ms 0ms   both ease-out; }
.lede                      { animation: rise 700ms 120ms both ease-out; }
.chapter--chronology       { animation: rise 700ms 240ms both ease-out; }
.chapter--territory        { animation: rise 700ms 320ms both ease-out; }
.chapter--matter           { animation: rise 700ms 400ms both ease-out; }
.chapter--parties          { animation: rise 700ms 480ms both ease-out; }
.chapter--registry         { animation: rise 700ms 560ms both ease-out; }
.colophon                  { animation: rise 700ms 700ms both ease-out; }

/* =============================================================================
   RESPONSIVE
   ----------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .paper { padding: 48px 24px; }
  .chapter { grid-template-columns: 1fr; gap: 12px; }
  .margin {
    border-right: 0;
    border-bottom: 1px solid var(--rule-soft);
    padding: 0 0 12px 0;
    text-align: left;
    flex-direction: row;
    align-items: baseline;
    gap: 16px;
  }
  .section-roman { font-size: 28px; margin: 0; }
  .chapter__heading { font-size: 32px; }
  .lede__numerals { gap: 0 16px; }
  .lede__sep { font-size: 36px; }
}
