/* 改革脈動 — front block + category pages + indicator page.
 *
 * Design tokens live on the component roots so the module stays self-contained.
 * Type scale: 7 steps. Weights: 4. Line heights: 4. Colours: one palette.
 */

body.page-route-gsaj-reform-page,
body.page-route-gsaj-reform-category {
  overflow-x: clip;
}

.reform-pulse,
.reform-page,
.indicator-detail {
  /* Colour */
  --g: #008454;
  --g-soft: #e6f3ed;
  --g-line: #cfe6db;
  --ink: #111827;
  --ink2: #374151;
  --muted: #6b7280;
  --faint: #6b7280;
  --line: #e5e7eb;
  --line-soft: #f3f4f6;
  --surface: #f9fafb;
  --chip-bg: #dfeee7;
  --note-bg: #eef2ff;
  --note-ink: #3730a3;
  --white: #fff;

  /* Type scale */
  --fs-1: 0.6875rem;  /* 11 · micro labels */
  --fs-2: 0.8125rem;  /* 13 · secondary */
  --fs-3: 0.9375rem;  /* 15 · base */
  --fs-4: 1.25rem;    /* 20 · heading */
  --fs-5: 1.375rem;   /* 22 · figure */
  --fs-6: 2rem;       /* 32 · page title */
  --fs-7: 2.75rem;    /* 44 · display */

  /* Weights */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Line heights */
  --lh-tight: 1.1;
  --lh-snug: 1.35;
  --lh-normal: 1.4;
  --lh-loose: 1.7;
}

/* -------------------------------------------------------------------------
 * Front-page block
 * ---------------------------------------------------------------------- */

.reform-pulse {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.25rem 1.5rem 1rem;
  margin: 2rem 0;
}

.reform-pulse .rp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.reform-pulse .rp-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-5);
  font-weight: var(--fw-bold);
}

.rp-bullet {
  display: inline-block;
  flex: none;
  width: 0.3rem;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--g);
}

.reform-pulse .rp-intro {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: var(--fs-3);
}

.rp-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.rp-col {
  --c: var(--g);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px;
  border-right: 1px solid var(--line);
}

.rp-col:last-child {
  border-right: 0;
}

.rp-col::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--c);
}

/* Dark → mid → light, in column order. */
.rp-col:nth-child(1) {
  --c: #00543a;
}

.rp-col:nth-child(2) {
  --c: #008454;
}

.rp-col:nth-child(3) {
  --c: #2f9e6d;
}

.rp-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 10px;
}

.rp-col-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: #00663f;
  font-size: var(--fs-4);
  font-weight: var(--fw-bold);
}

/* All items share one grid cell, so the column height is the tallest item:
   no magic min-height and no jump when the text wraps. */
.rp-rot {
  display: grid;
}

.rp-item {
  grid-area: 1 / 1;
  visibility: hidden;
  opacity: 0;
}

.rp-item.is-active {
  visibility: visible;
  opacity: 1;
  animation: rp-fade 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .rp-item.is-active {
    animation: none;
  }
}

@keyframes rp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rp-col-value {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-7);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.rp-unit {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: var(--fs-3);
  font-weight: var(--fw-medium);
  letter-spacing: 0;
}

.rp-col-name {
  margin: 8px 0 0;
  color: var(--ink2);
  font-size: var(--fs-3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}

.rp-col-sub {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--faint);
  font-size: var(--fs-2);
  line-height: var(--lh-normal);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.rp-group-link {
  margin-top: auto;
  padding-top: 14px;
  color: var(--g);
  font-size: var(--fs-2);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.rp-group-link:hover {
  text-decoration: underline;
}

.rp-footnote {
  margin: 0.9rem 0 0;
  color: var(--faint);
  font-size: var(--fs-2);
  text-align: right;
}

/* -------------------------------------------------------------------------
 * Category page
 * ---------------------------------------------------------------------- */

.reform-page {
/*  max-width: 1100px; */
  margin: 0 auto 3rem;
}

.reform-page .whitebox {
  padding: 1.25rem 1.5rem 1rem;
}

.rc-head {
  position: sticky;
  /* Sit right below the site's fixed header. */
  top: 5.5rem;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0 0.75rem;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}

.rc-eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: var(--fs-3);
  font-weight: var(--fw-regular);
}

.rc-reform-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-6);
  font-weight: var(--fw-bold);
  padding: 0.5rem 0 0.25rem;
}

.rc-tagline {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: var(--fs-3);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
}

.rc-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-6);
  font-weight: var(--fw-bold);
}

.rc-intro {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: var(--fs-2);
}

.rc-tabs {
  display: flex;
  gap: 1.75rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

.rc-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: -1px;
  padding: 0.6rem 0.25rem;
  border-bottom: 3px solid transparent;
  color: var(--ink2);
  font-size: var(--fs-3);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.rc-tab:hover,
.rc-tab:focus-visible {
  color: var(--g);
  text-decoration: none;
}

.rc-tab.is-active {
  color: var(--g);
  border-bottom-color: var(--g);
}

.rc-tab-count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink2);
  font-size: var(--fs-1);
  font-weight: var(--fw-semibold);
  line-height: 1.25rem;
  text-align: center;
}

.rc-tab.is-active .rc-tab-count {
  background: var(--g);
  color: var(--white);
}

.rc-body {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.rc-rail-wrap {
  align-self: stretch;
  min-width: 0;
}

.rc-rail {
  position: sticky;
  /* Site header (~5.5rem) + the sticky category header below it. */
  top: 11rem;
  align-self: start;
  display: flex;
  flex-direction: column;
}

.rc-rail-i {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: var(--fs-3);
  text-decoration: none;
}

.rc-rail-i i {
  color: var(--faint);
  font-size: var(--fs-1);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.rc-rail-i.is-active i {
  color: #00543a;
}

.rc-rail-i:hover {
  color: var(--g);
  text-decoration: none;
}

.rc-rail-i.is-active {
  border-left-color: var(--g);
  background: var(--g-soft);
  color: var(--g);
  font-weight: var(--fw-bold);
}

.rc-rail-i:focus-visible {
  outline: 2px solid var(--g);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .rc-rail.is-fixed {
    position: fixed;
    top: 11rem;
    z-index: 15;
    box-sizing: border-box;
    padding: 0.25rem 0 0;
    background: var(--white);
    overflow-y: hidden;
    overscroll-behavior: contain;
    scrollbar-width: auto;
    scrollbar-color: var(--g) rgba(0, 84, 58, 0.1);
  }

  .rc-rail.is-fixed.is-scrollable {
    overflow-y: scroll;
  }

  .rc-rail.is-fixed::-webkit-scrollbar {
    width: 8px;
  }

  .rc-rail.is-fixed::-webkit-scrollbar-thumb {
    background: var(--g);
    border: 2px solid var(--white);
    border-radius: 999px;
  }

  .rc-rail.is-fixed::-webkit-scrollbar-track {
    background: rgba(0, 84, 58, 0.1);
  }
}

.rc-rail-cue {
  display: none;
}

.rc-rail.is-scrollable .rc-rail-cue {
  display: block;
  position: sticky;
  bottom: 0;
  flex: none;
  margin-top: auto;
  z-index: 2;
  padding: 0.125rem 0 0.25rem;
  background: var(--white);
  color: var(--g);
  font-size: 0.875rem;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.rc-rail.is-scrollable .rc-rail-cue::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 1rem;
  background: linear-gradient(to top, var(--white), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.rc-main {
  min-width: 0;
}

.rc-section {
  margin-bottom: 2rem;
  /* Site header (~5.5rem) + sticky category header (~5rem). */
  scroll-margin-top: 11rem;
}

.rc-section:first-child {
  margin-top: 0;
}

.rc-section:last-child {
  margin-bottom: 0;
}

.rc-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  color: var(--ink);
  font-size: var(--fs-4);
  font-weight: var(--fw-bold);
}

.rc-section-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 0.95rem;
  border-radius: 2px;
  background: var(--g);
}

.rc-sec-count {
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink2);
  font-size: var(--fs-1);
  font-weight: var(--fw-semibold);
  line-height: 1.25rem;
}

.rc-rows {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  list-style: none;
}

.rc-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.rc-row:last-child {
  border-bottom: 0;
}

.rc-row:hover {
  background: var(--surface);
}

.rc-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--g-soft);
  color: var(--g);
  font-size: var(--fs-3);
}

.rc-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rc-row-title {
  color: var(--ink);
  font-size: var(--fs-3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
}

.rc-row-sub {
  color: var(--faint);
  font-size: var(--fs-2);
  line-height: var(--lh-snug);
}

.rc-row-val {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
}

.rc-row-note {
  color: var(--faint);
  font-size: var(--fs-1);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.rc-row-value {
  min-width: 124px;
  color: var(--ink);
  font-size: var(--fs-5);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rc-row-value.is-empty {
  color: var(--faint);
  font-weight: var(--fw-medium);
}

.rc-row-unit {
  margin-left: 0.2rem;
  color: var(--muted);
  font-size: var(--fs-2);
  font-weight: var(--fw-medium);
}

.reform-page .rp-footnote {
  margin-top: 1.5rem;
}

/* -------------------------------------------------------------------------
 * Indicator page
 * ---------------------------------------------------------------------- */

.indicator-detail {
  max-width: 960px;
  margin: 0 auto 3rem;
}

.ind-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  color: var(--faint);
  font-size: var(--fs-2);
}

.ind-crumb a {
  color: var(--g);
  text-decoration: none;
}

.indicator-detail .ind-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0.75rem 0 1rem;
}

.indicator-detail .ind-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: var(--g);
  color: var(--white);
  font-size: var(--fs-4);
}

.indicator-detail .ind-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-6);
  font-weight: var(--fw-bold);
}

.indicator-detail .ind-sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.indicator-detail .ind-kpi {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: var(--surface);
}

.indicator-detail .ind-value {
  color: var(--ink);
  font-size: var(--fs-7);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}

.indicator-detail .ind-unit {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: var(--fs-4);
  font-weight: var(--fw-regular);
}

.indicator-detail .ind-note {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--note-bg);
  color: var(--note-ink);
  font-size: var(--fs-2);
}

.indicator-detail .ind-block {
  margin-top: 2rem;
}

.indicator-detail .ind-h2 {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: var(--fs-4);
  font-weight: var(--fw-bold);
}

.indicator-detail .ind-def {
  color: var(--ink2);
  line-height: var(--lh-loose);
}

.indicator-detail .ind-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: var(--fs-2);
}

.indicator-detail .ind-related-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.indicator-detail .ind-related-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink2);
  text-decoration: none;
}

.indicator-detail .ind-related-list a:hover {
  border-color: var(--g);
  text-decoration: none;
}

.indicator-detail .ind-related-value {
  color: var(--ink);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}

.indicator-detail .ind-related-value small {
  margin-left: 0.15rem;
  color: var(--muted);
  font-weight: var(--fw-regular);
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .reform-pulse,
  .reform-page,
  .indicator-detail {
    --fs-6: 1.75rem;
  }

  .rp-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .rp-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rp-col:last-child {
    border-bottom: 0;
  }

  .rc-head {
    top: 4.5rem;
  }

  .rc-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .rc-rail {
    position: static;
    flex-direction: row;
    gap: 0.4rem;
    padding-bottom: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .rc-rail::-webkit-scrollbar {
    display: none;
  }

  .rc-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .rc-tabs::-webkit-scrollbar {
    display: none;
  }

  .rc-rail-i {
    flex: none;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    white-space: nowrap;
  }

  .rc-rail-i.is-active {
    border-color: var(--g);
    background: var(--g-soft);
  }
}

@media (max-width: 1000px) {
  html:lang(pt) .rc-tabs {
    flex-wrap: wrap;
    overflow: visible;
    gap: 0.5rem 1.25rem;
  }

  html:lang(pt) .rc-rail {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 0.4rem;
  }
}

@media (max-width: 767.98px) {
  .rc-row {
    grid-template-columns: 26px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .rc-row-title {
    font-size: 1.125rem;
  }

  .rc-row-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
  }

  .rc-row-val {
    flex-wrap: nowrap;
    flex-direction: column;
    align-items: flex-end;
  }

  .rc-row-value {
    order: 1;
    min-width: 0;
    font-size: 1.125rem;
  }

  .rc-row-note {
    order: 2;
    white-space: normal;
    max-width: min(14ch, 96px);
    text-align: right;
    line-height: 1.25;
  }

  .rc-row-unit {
    display: inline;
    margin-left: 2px;
  }
}

@media (max-width: 575.98px) {
  .reform-pulse,
  .reform-page,
  .indicator-detail {
    --fs-7: 2.25rem;
  }

  .reform-pulse {
    padding: 1rem;
  }

  .rc-row {
    padding: 10px 12px;
  }

  .rc-row-value {
    min-width: 0;
  }

  .indicator-detail .ind-related-list {
    grid-template-columns: minmax(0, 1fr);
  }
}
