/* ==========================================================================
   ledger.css — sector ledger (homepage) + achievements record (inner page)
   Namespaced .led-* and .achp-* so nothing collides with style.css.
   Scoped token block only — the single :root block in style.css is untouched.
   Green ramp is derived mathematically from the master hue #123D27
   (H 149deg, S 54.4%) by raising lightness only.
   ========================================================================== */

.led,
.achp {
  --led-1: #123D27;   /* L 15.5%  — largest share */
  --led-2: #1B5D3B;   /* L 23.5%  */
  --led-3: #268052;   /* L 32.5%  */
  --led-4: #33AB6E;   /* L 43.5%  */
  --led-5: var(--saffron);   /* the real accent — keeps the 2% segment visible */
  --led-rule: color-mix(in srgb, currentColor 14%, transparent);
  --led-rule-strong: color-mix(in srgb, currentColor 34%, transparent);
  --led-quiet: color-mix(in srgb, currentColor 62%, transparent);
}

/* --------------------------------------------------------- allocation bar */

.led-alloc {
  margin: var(--s-7) 0;
}

.led-alloc__bar {
  display: flex;
  width: 100%;
  height: 0.75rem;
  overflow: hidden;
  border-radius: 2px;
  background: var(--led-rule);
}

.led-alloc__seg {
  display: block;
  flex: 0 0 auto;
  width: var(--w);
  min-width: 3px;
  height: 100%;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.9);
}

.led-alloc__seg:last-child { box-shadow: none; }

.led-alloc__seg[data-seg="roads"] { background: var(--led-1); }
.led-alloc__seg[data-seg="rail"]  { background: var(--led-2); }
.led-alloc__seg[data-seg="water"] { background: var(--led-3); }
.led-alloc__seg[data-seg="air"]   { background: var(--led-4); }
.led-alloc__seg[data-seg="rest"]  { background: var(--led-5); }

.led-alloc__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.led-alloc__key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--note-ink);
}

.led-key {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.led-key::before {
  content: "";
  align-self: center;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 2px;
  flex: 0 0 auto;
}

.led-key[data-seg="roads"]::before { background: var(--led-1); }
.led-key[data-seg="rail"]::before  { background: var(--led-2); }
.led-key[data-seg="water"]::before { background: var(--led-3); }
.led-key[data-seg="air"]::before   { background: var(--led-4); }
.led-key[data-seg="rest"]::before  { background: var(--led-5); }

.led-key b {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

/* ---------------------------------------------------------- sector cards */

.led-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--led-rule-strong);
}

/* 8 cards: 1 / 2 / 4 columns. Explicit counts, never auto-fit — auto-fit
   produced a 5-wide row and left two empty bordered cells behind. */
@media (min-width: 34rem) { .led-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .led-grid { grid-template-columns: repeat(4, 1fr); } }

@media (min-width: 34rem) and (max-width: 61.99rem) {
  .led-card:nth-child(2n) { border-right: 0; }
  .led-card:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (min-width: 62rem) {
  .led-card:nth-child(4n) { border-right: 0; }
  .led-card:nth-last-child(-n+4) { border-bottom: 0; }
}

.led-card {
  padding: var(--s-5) var(--s-5) var(--s-6) 0;
  border-bottom: 1px solid var(--led-rule);
  border-right: 1px solid var(--led-rule);
  transition: border-color 0.3s ease;
}

.led-card:hover { border-bottom-color: var(--led-rule-strong); }

.led-card__k {
  margin: 0 0 0.5rem;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--note-ink);
}

.led-card__v {
  margin: 0 0 var(--s-5);
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.led-card__v small {
  display: block;
  margin-top: 0.35rem;
  font-family: inherit;
  font-size: 0.6em;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--led-quiet);
}

.led-card__list {
  margin: 0 0 var(--s-5);
  padding: 0;
  list-style: none;
}

.led-card__list li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--led-rule);
}

.led-card__n {
  display: block;
  font-size: 0.9375rem;
  line-height: 1.35;
}

.led-card__m {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
  color: var(--note-ink);
}

.led-card__more {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--led-rule);
  font-size: var(--t-xs);
  line-height: 1.5;
  color: var(--led-quiet);
}

/* --------------------------------------------------------- beyond the ledger */

.led-beyond {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 2px solid var(--led-rule-strong);
}

.led-beyond__k {
  margin: 0 0 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--saffron-ink);
}

.led-beyond__lede {
  margin: 0 0 var(--s-6);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
  max-width: 48ch;
}

.led-beyond__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: var(--s-6) var(--s-7);
}

.led-b h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  line-height: 1.3;
}

.led-b p {
  margin: 0;
  max-width: 54ch;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--note-ink);
}

/* ================================================= achievements inner page */

.achp-intro {
  max-width: 62ch;
}

.achp-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: var(--s-6) 0 0;
  padding: 0;
  list-style: none;
}

.achp-jump a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--led-rule-strong);
  border-radius: 999px;
  font-size: var(--t-xs);
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.achp-jump a:hover,
.achp-jump a:focus-visible {
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 7%, transparent);
}

.achp-sec {
  padding-top: var(--s-7);
  scroll-margin-top: 5rem;
}

.achp-sec + .achp-sec {
  margin-top: var(--s-7);
  border-top: 1px solid var(--led-rule);
}

.achp-sec__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: var(--s-5);
}

.achp-sec__head h2 {
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.875rem);
  line-height: 1.2;
}

.achp-sec__v {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.achp-sec__v span {
  display: block;
  font-size: 0.7em;
  font-weight: 500;
  text-align: right;
  color: var(--led-quiet);
}

.achp-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--led-rule-strong);
}

.achp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--led-rule);
}

.achp-row__t {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.achp-row__t small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--note-ink);
}

.achp-row__v {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.achp-row__v em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--led-quiet);
}

@media (max-width: 34rem) {
  .achp-row { grid-template-columns: minmax(0, 1fr); }
  .achp-row__v { text-align: left; }
  .achp-row__v em { display: inline; margin-left: 0.5rem; }
}

/* ------------------------------------------------------------- shared bits */

.led-card:focus-visible,
.achp-jump a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .led-card,
  .achp-jump a { transition: none; }
}

@media (min-width: 34rem) and (max-width: 61.99rem) {
  .led-card { padding-right: var(--s-4); }
}

@media (max-width: 34rem) {
  .led-card {
    padding-right: 0;
    border-right: 0;
  }
  .led-alloc__bar { height: 0.875rem; }
}
