:root {
  --bg: #f4f0e8;
  --bg-glow: rgba(139, 119, 84, 0.08);
  --text: #17130f;
  --muted: #64584a;
  --line: rgba(23, 19, 15, 0.14);
  --line-strong: rgba(23, 19, 15, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, var(--bg-glow), transparent 32rem),
    radial-gradient(circle at top right, rgba(197, 176, 145, 0.08), transparent 28rem),
    linear-gradient(180deg, #f8f5ef 0%, var(--bg) 100%);
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: none;
}

.page-shell {
  width: min(1040px, calc(100vw - 2.5rem));
  margin: 0 auto;
  padding: 0 0 2rem;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.8rem 0;
  background: transparent;
}

.top-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--bg);
  z-index: -1;
}

.top-strip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100vw;
  height: 1px;
  transform: translateX(-50%);
  background: var(--line-strong);
}

.item-index {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.62rem;
  color: var(--muted);
}

.top-strip h1 {
  margin: 0;
  max-width: none;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 600;
}

.timeline {
  padding-top: 1.25rem;
  padding-bottom: 55vh;
}

.load-error {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.generation {
  margin-top: 1rem;
  padding: 0;
}

.generation-items {
  display: flex;
  flex-direction: column;
}

.spending-item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  opacity: 1;
  transition:
    opacity 260ms ease,
    transform 260ms ease;
}

.spending-item.index-suppressed .item-index {
  visibility: hidden;
}

.item-index {
  padding-top: 0.18rem;
  line-height: 1;
}

.spending-item.wsipp-continuation {
  border-top: none;
}

.spending-item:first-child {
  border-top: none;
}

.item-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.item-impact {
  margin: 0;
  max-width: none;
  font-family: "Cormorant Garamond", serif;
  font-size: 1rem;
  line-height: 1.08;
  font-weight: 500;
}

.item-title {
  margin: 0;
  max-width: none;
}

.item-link {
  font-family: "Instrument Sans", sans-serif;
  font-size: 0.58rem;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.item-link:hover,
.item-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.16rem;
}

.item-link.is-plain:hover,
.item-link.is-plain:focus-visible {
  text-decoration: none;
}

.type-target {
  min-height: 1.4em;
}

.refresh-button {
  appearance: none;
  border: 1px solid rgba(20, 16, 12, 0.18);
  background: linear-gradient(180deg, #201913 0%, #17120d 100%);
  color: #f8f3ea;
  border-radius: 999px;
  padding: 0.48rem 0.72rem;
  min-width: 0;
  font: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 220ms ease,
    opacity 220ms ease;
}

.refresh-button:hover:not(:disabled),
.refresh-button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
}

.refresh-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.generation.revealed {
  animation: rise-in 620ms ease both;
}

.generation-separator {
  width: 100vw;
  height: 1px;
  margin: 1.25rem calc(50% - 50vw) 0.25rem;
  background: var(--line-strong);
}

.spending-item.is-pending {
  opacity: 0;
  transform: translateY(18px);
}

.spending-item.is-active {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 1.25rem, 100%);
    padding-top: 0;
  }

  body::before {
    background: none;
  }

  .generation {
    padding-inline: 0;
  }

  .controls {
    display: block;
  }

  .item-meta {
    display: flex;
  }

  .top-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.6rem;
  }

  .refresh-button {
    width: auto;
  }
}
