/* ===========================================================================
   The four views that are the reason to choose this over the incumbents.

   Motion rule, same as the rest of the app: the markup carries the finished
   state and animation runs *from* zero. A starved frame loop, a failed fetch
   or reduced-motion leaves correct, readable content rather than a blank box.
   ======================================================================== */

/* ---- the live waste counter ---- */

.ledger-hero {
  position: relative; overflow: hidden;
  border-radius: 16px; padding: 30px 30px 26px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 140% at 85% -10%,
      color-mix(in srgb, var(--critical) 13%, transparent) 0%, transparent 62%),
    var(--surface-1);
}
.ledger-hero::after {
  /* A slow sweep, so the panel reads as live rather than as a screenshot. */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%,
    color-mix(in srgb, var(--critical) 7%, transparent) 50%, transparent 62%);
  transform: translateX(-100%);
  animation: ledger-sweep 7s ease-in-out infinite;
}
@keyframes ledger-sweep { 0%, 55% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.ledger-hero .eyebrow {
  font-size: 11px; font-weight: 650; letter-spacing: .09em;
  text-transform: uppercase; color: var(--critical);
  display: flex; align-items: center; gap: 7px;
}
.ledger-hero .eyebrow .pip {
  width: 7px; height: 7px; border-radius: 50%; background: var(--critical);
  animation: pip 1.9s ease-in-out infinite;
}
@keyframes pip { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.78); } }

.ledger-hero .amount {
  font-size: clamp(38px, 7vw, 68px); font-weight: 700; line-height: 1.02;
  letter-spacing: -.028em; margin: 10px 0 2px;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
}
/* The fractional part ticks many times a second; at full size it is a
   distraction, at this size it reads as a pulse. */
.ledger-hero .amount .cents { font-size: .46em; opacity: .5; font-weight: 600; }
.ledger-hero .since { font-size: 13.5px; color: var(--text-secondary); max-width: 62ch; }

.ledger-rates { display: flex; flex-wrap: wrap; gap: 26px; margin-top: 22px; }
.ledger-rates > div .k {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 650;
}
.ledger-rates > div .v {
  font-size: 19px; font-weight: 650; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---- the "what waiting costs" row ---- */

.wait-row { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 720px) { .wait-row { grid-template-columns: repeat(3, 1fr); } }
.wait-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  background: var(--surface-1); transition: transform .18s ease, border-color .18s ease;
}
.wait-card:hover { transform: translateY(-2px); border-color: var(--axis); }
.wait-card .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase;
                letter-spacing: .06em; font-weight: 650; }
.wait-card .v { font-size: 25px; font-weight: 700; margin-top: 4px;
                font-variant-numeric: tabular-nums; }

/* ---- leak list ---- */

.leak {
  display: grid; gap: 4px 14px; align-items: center; padding: 13px 2px;
  grid-template-columns: 1fr auto; border-bottom: 1px solid var(--border);
}
.leak:last-child { border-bottom: 0; }
.leak .title { font-size: 13.5px; font-weight: 550; }
.leak .meta { font-size: 11.5px; color: var(--text-muted); grid-column: 1; }
.leak .cost { text-align: right; font-variant-numeric: tabular-nums; }
.leak .cost b { font-size: 16px; }
.leak .cost span { display: block; font-size: 11px; color: var(--text-muted); }
.leak .age {
  /* Length encodes how long it has been leaking, so the list is scannable
     before any number is read. */
  grid-column: 1 / -1; height: 3px; border-radius: 2px;
  background: var(--neutral-fill); overflow: hidden; margin-top: 5px;
}
.leak .age > i { display: block; height: 100%; background: var(--critical); opacity: .55;
                 width: 0; transition: width .9s cubic-bezier(.22,1,.36,1); }

/* ---- change attribution timeline ---- */

.tl { position: relative; padding-left: 26px; }
.tl::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--border), var(--border) 70%, transparent);
}
.tl-day { position: relative; padding: 0 0 20px; }
.tl-day::before {
  content: ""; position: absolute; left: -23px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface-1); border: 2px solid var(--axis);
}
.tl-day.up::before     { border-color: var(--critical); }
.tl-day.down::before   { border-color: var(--success-text, var(--good)); }
.tl-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tl-head .date { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tl-head .step { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-head .step.up { color: var(--critical); }
.tl-head .step.down { color: var(--success-text, var(--good)); }
.tl-verdict { font-size: 12.5px; color: var(--text-secondary); margin: 3px 0 9px; }
.tl-ev {
  display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--page); margin-bottom: 6px;
}
.tl-ev .tag {
  flex: none; font-size: 10px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .05em; padding: 2px 7px; border-radius: 5px;
  background: var(--neutral-fill); color: var(--text-secondary);
}
.tl-ev .tag.created { background: color-mix(in srgb, var(--critical) 15%, transparent); color: var(--critical); }
.tl-ev .tag.removed { background: color-mix(in srgb, var(--good) 17%, transparent); color: var(--success-text, var(--good)); }
.tl-ev .d { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 650; flex: none; }

/* How much of a move the recorded changes account for. The bar is the
   evidence; the words beside it are what is actually claimed. */
.explain { height: 7px; border-radius: 4px; background: var(--neutral-fill);
           overflow: hidden; display: flex; margin: 8px 0 4px; }
.explain > i { display: block; height: 100%; width: 0;
               transition: width .8s cubic-bezier(.22,1,.36,1); }
.explain > i.known { background: var(--series-1); }
.explain > i.unknown { background: repeating-linear-gradient(45deg,
  var(--neutral-fill), var(--neutral-fill) 4px, var(--axis) 4px, var(--axis) 8px); }

/* ---- movers ---- */

.mover {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.mover:last-child { border-bottom: 0; }
.mover .glyphbox {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 13px; background: var(--neutral-fill); color: var(--text-secondary);
}
.mover.up .glyphbox   { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.mover.down .glyphbox { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--success-text, var(--good)); }
.mover .what { font-size: 13px; }
.mover .what small { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
.mover .amt { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; text-align: right; }
.mover .amt small { display: block; font-weight: 500; font-size: 11px; color: var(--text-muted); }

/* ---- commitment lab ---- */

.lab-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1080px) { .lab-grid { grid-template-columns: 1.55fr 1fr; } }

.lab-stage {
  position: relative; height: 420px; border-radius: 13px; overflow: hidden;
  border: 1px solid var(--border); background: var(--page);
  touch-action: none; cursor: grab;
}
.lab-stage:active { cursor: grabbing; }
.lab-stage canvas { display: block; }
.lab-hint {
  position: absolute; left: 12px; bottom: 10px; font-size: 11px;
  color: var(--text-muted); pointer-events: none;
  background: color-mix(in srgb, var(--surface-1) 82%, transparent);
  padding: 4px 9px; border-radius: 7px;
}
.lab-readout {
  position: absolute; right: 12px; top: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--surface-1) 93%, transparent);
  border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px;
  font-variant-numeric: tabular-nums; min-width: 164px;
}
.lab-readout .big { font-size: 24px; font-weight: 700; line-height: 1.1; }
.lab-readout .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
                  color: var(--text-muted); font-weight: 650; }
.lab-readout .r { display: flex; justify-content: space-between; gap: 14px;
                  font-size: 12px; margin-top: 5px; }

.lab-slider { margin: 16px 0 6px; }
.lab-slider input[type="range"] { width: 100%; accent-color: var(--series-1); height: 24px; }
.lab-marks { display: flex; justify-content: space-between; font-size: 11px;
             color: var(--text-muted); font-variant-numeric: tabular-nums; }

.lab-pick {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px;
}
.lab-pick button {
  text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-1); cursor: pointer;
  transition: border-color .16s ease, transform .16s ease;
}
.lab-pick button:hover { transform: translateY(-2px); border-color: var(--series-1); }
.lab-pick button[aria-pressed="true"] {
  border-color: var(--series-1);
  background: color-mix(in srgb, var(--series-1) 8%, var(--surface-1));
}
.lab-pick .n { font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
               color: var(--text-muted); font-weight: 650; }
.lab-pick .a { font-size: 16px; font-weight: 700; margin-top: 3px;
               font-variant-numeric: tabular-nums; }
.lab-pick .s { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ---- carbon ---- */

.co2-hero { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 780px) { .co2-hero { grid-template-columns: auto 1fr; } }
.co2-dial { position: relative; width: 168px; height: 168px; }
.co2-dial svg { transform: rotate(-90deg); }
.co2-dial .ring-bg { fill: none; stroke: var(--neutral-fill); stroke-width: 13; }
.co2-dial .ring-fg {
  fill: none; stroke: var(--series-3, #1baf7a); stroke-width: 13; stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(.22,1,.36,1);
}
.co2-dial .mid {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.co2-dial .mid b { font-size: 25px; font-variant-numeric: tabular-nums; display: block; }
.co2-dial .mid span { font-size: 11px; color: var(--text-muted); }

.co2-region { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px;
              padding: 11px 0; border-bottom: 1px solid var(--border); }
.co2-region:last-child { border-bottom: 0; }
.co2-region .n { font-size: 13px; font-weight: 550; }
.co2-region .i { font-size: 11.5px; color: var(--text-muted); grid-column: 1; }
.co2-region .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.co2-region .share { grid-column: 1 / -1; height: 4px; border-radius: 2px;
                   background: var(--neutral-fill); overflow: hidden; margin-top: 4px; }
.co2-region .share > i { display: block; height: 100%; width: 0;
                       background: var(--series-3, #1baf7a);
                       transition: width .9s cubic-bezier(.22,1,.36,1); }

/* ---- shared entrance ---- */

/* Visible by default; only hidden once the motion layer confirms it can run,
   so no content depends on JavaScript to appear. */
html.anim .rise { opacity: 0; transform: translateY(14px); }
.rise { transition: opacity .55s ease, transform .55s cubic-bezier(.22,1,.36,1); }
.rise.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .ledger-hero::after, .ledger-hero .eyebrow .pip { animation: none; }
  .rise, .leak .age > i, .explain > i, .co2-region .share > i, .co2-dial .ring-fg {
    transition: none;
  }
  html.anim .rise { opacity: 1; transform: none; }
}

/* Sub-cent accrual. The cents digit on a typical estate advances once every
   twenty seconds or so; this fills smoothly across the current cent, so the
   panel is visibly live without overstating the rate. */
.ledger-hero .accruing {
  height: 3px; width: 150px; border-radius: 2px; margin: 2px 0 14px;
  background: var(--neutral-fill); overflow: hidden;
}
.ledger-hero .accruing > i {
  display: block; height: 100%; width: 0; background: var(--critical); opacity: .6;
}
@media (prefers-reduced-motion: reduce) { .ledger-hero .accruing { display: none; } }
