.network-page {
  background: var(--understory);
}

.network-page::before {
  background:
    radial-gradient(circle at 50% 16%, rgba(101, 125, 95, 0.14), transparent 31rem),
    linear-gradient(180deg, rgba(7, 12, 9, 0.86), rgba(7, 12, 9, 0.98)),
    url("../fig/shade-tree-banner.webp") center / cover no-repeat;
}

.network-hero {
  position: relative;
  min-height: max(47rem, calc(100svh - 1.5rem));
  margin: 0.75rem;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 55% 46%, rgba(70, 102, 71, 0.13), transparent 26rem),
    linear-gradient(145deg, #09130e, #07100c 66%);
  border: 1px solid var(--line);
  border-radius: 0.45rem;
}

.network-hero::before,
.network-hero::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.network-hero::before {
  inset: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(147, 164, 134, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147, 164, 134, 0.035) 1px, transparent 1px);
  background-size: 4.5rem 4.5rem;
  mask-image: radial-gradient(circle at 54% 48%, #000, transparent 70%);
}

.network-hero::after {
  right: 7%;
  bottom: -11rem;
  width: 44rem;
  height: 21rem;
  background: rgba(57, 82, 58, 0.08);
  border-radius: 50%;
  filter: blur(58px);
  transform: rotate(-9deg);
}

.network-dashboard {
  position: relative;
  display: grid;
  width: var(--page);
  min-height: clamp(34rem, calc(100svh - 11.5rem), 46rem);
  grid-template-columns: minmax(14rem, 25rem) minmax(28rem, 43rem);
  gap: clamp(1rem, 2vw, 2.5rem);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 1.5rem 0 7rem;
}

.network-copy {
  position: relative;
  z-index: 4;
}

.network-copy h1 {
  max-width: 8ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.6rem, 5.7vw, 6.6rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.88;
  text-wrap: balance;
}

.network-copy h1 span {
  color: var(--pulse);
}

.network-copy p {
  max-width: 25rem;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.network-copy p a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(226, 190, 103, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.network-copy p a:hover,
.network-copy p a:focus-visible {
  color: var(--lichen);
  text-decoration-color: var(--pulse);
}

.snapshot-state {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin: 0;
  color: var(--leaf);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.state-pulse {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  background: var(--pulse);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(226, 190, 103, 0.42);
}

.network-page.is-checking .state-pulse {
  animation: checking 1.25s ease-out infinite;
}

.network-page.is-stale .state-pulse {
  background: var(--moss);
  box-shadow: none;
}

.network-page.is-unavailable .state-pulse {
  background: rgba(227, 233, 221, 0.28);
  box-shadow: none;
}

.network-visual {
  position: relative;
  z-index: 2;
  display: grid;
  grid-row: span 2;
  width: min(100%, 43rem);
  gap: 0;
  justify-items: center;
  margin: 0;
}

.network-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: visible;
}

.network-foot {
  width: 100%;
  margin-top: 1.8rem;
}

.network-stage::before,
.network-stage::after {
  position: absolute;
  content: "";
  pointer-events: none;
  border-radius: 50%;
}

.network-stage::before {
  inset: 9%;
  background: radial-gradient(circle, rgba(74, 110, 74, 0.16), rgba(28, 50, 33, 0.05) 48%, transparent 71%);
  filter: blur(11px);
}

.network-stage::after {
  z-index: 5;
  inset: 2%;
  box-shadow: inset 2rem -2rem 5rem rgba(3, 8, 5, 0.33);
}

.network-stage canvas {
  position: absolute;
  z-index: 2;
  inset: -4%;
  width: 108%;
  height: 108%;
  opacity: 0;
  transition: opacity 650ms ease;
}

.network-stage.is-live canvas {
  opacity: 1;
}

.canopy-fallback {
  position: absolute;
  z-index: 1;
  inset: 8%;
  border: 1px solid rgba(147, 164, 134, 0.16);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 28%, rgba(151, 176, 130, 0.2), transparent 23%),
    radial-gradient(circle at 53% 50%, #18301f, #0b1710 59%, rgba(5, 12, 8, 0.26) 73%);
  box-shadow:
    inset -2rem -2rem 4rem rgba(2, 6, 4, 0.7),
    inset 1rem 1rem 3rem rgba(112, 139, 100, 0.08),
    0 0 5rem rgba(64, 93, 61, 0.15);
  transition: opacity 500ms ease;
}

.canopy-fallback::before,
.canopy-fallback::after {
  position: absolute;
  inset: 12%;
  content: "";
  border: 1px solid rgba(147, 164, 134, 0.13);
  border-radius: 50%;
}

.canopy-fallback::before {
  transform: scaleX(0.4);
}

.canopy-fallback::after {
  transform: scaleY(0.38);
}

.network-stage.is-live .canopy-fallback {
  opacity: 0;
}

.fallback-orbit {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 117%;
  height: 36%;
  border: 1px solid rgba(226, 190, 103, 0.24);
  border-radius: 50%;
}

.fallback-orbit-a {
  transform: translate(-50%, -50%) rotate(24deg);
}

.fallback-orbit-b {
  transform: translate(-50%, -50%) rotate(-38deg) scaleY(0.7);
}

.fallback-grove {
  position: absolute;
  z-index: var(--depth);
  top: var(--y);
  left: var(--x);
  width: calc(0.3rem * var(--scale));
  height: calc(0.86rem * var(--scale));
  background: #5b4b35;
  border-radius: 0.2rem;
  opacity: var(--alpha);
  filter: saturate(0.92);
  transform: translate(-50%, -65%) rotate(var(--turn));
}

.fallback-grove::before,
.fallback-grove::after {
  position: absolute;
  content: "";
  border-radius: 52% 43% 48% 45%;
}

.fallback-grove::before {
  top: -0.42rem;
  left: 50%;
  width: calc(1rem * var(--scale));
  height: calc(0.72rem * var(--scale));
  background: #607454;
  box-shadow:
    calc(0.56rem * var(--scale)) calc(0.2rem * var(--scale)) 0 calc(-0.16rem * var(--scale)) #405b41,
    calc(-0.52rem * var(--scale)) calc(0.26rem * var(--scale)) 0 calc(-0.17rem * var(--scale)) #78906a;
  transform: translateX(-50%);
}

.fallback-grove::after {
  top: calc(-0.84rem * var(--scale));
  left: 50%;
  width: calc(0.58rem * var(--scale));
  height: calc(0.5rem * var(--scale));
  background: #718462;
  transform: translateX(-50%);
}

.provenance-panel {
  position: relative;
  z-index: 4;
  grid-column: 1;
  padding: 1rem;
  background: rgba(10, 20, 14, 0.56);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.provenance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.provenance-head strong {
  color: var(--pulse);
  font-weight: 500;
}

.provenance-panel dl {
  margin: 0;
}

.provenance-panel dl div {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 0.8rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid rgba(147, 164, 134, 0.12);
}

.provenance-panel dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.provenance-panel dt {
  color: rgba(227, 233, 221, 0.6);
  font-size: 0.74rem;
}

.provenance-panel dd {
  margin: 0;
  color: var(--leaf);
  font-size: 0.76rem;
  text-align: right;
}

.network-data {
  position: absolute;
  z-index: 8;
  right: max(1.5rem, calc((100% - var(--page)) / 2));
  bottom: 1.4rem;
  left: max(1.5rem, calc((100% - var(--page)) / 2));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  background: rgba(7, 14, 10, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.network-data div {
  min-width: 0;
  padding: 0.85rem 1rem;
}

.network-data div + div {
  border-left: 1px solid var(--line);
}

.network-data dt,
.history-summary dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.network-data dd,
.history-summary dd {
  margin: 0.12rem 0 0;
  color: var(--lichen);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
}

.grove-main {
  display: grid;
  width: var(--page);
  margin: clamp(2.5rem, 6vw, 5rem) auto clamp(2rem, 4vw, 3rem);
}

.history-panel {
  background: rgba(12, 23, 16, 0.82);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: minmax(13rem, 0.72fr) minmax(20rem, 1.7fr) minmax(8rem, 0.45fr);
  gap: clamp(1.5rem, 3vw, 3.2rem);
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2.5rem);
}

.section-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 3.5vw, 3.4rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.section-copy p {
  max-width: 24rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-chart {
  min-width: 0;
}

.history-chart svg {
  display: block;
  width: 100%;
  height: 12.5rem;
  overflow: visible;
}

.chart-grid path {
  fill: none;
  stroke: rgba(147, 164, 134, 0.13);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.history-area {
  fill: url("#history-fill");
}

.history-line {
  fill: none;
  stroke: var(--pulse);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.history-point {
  fill: var(--understory);
  stroke: var(--pulse);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  color: rgba(227, 233, 221, 0.4);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.history-summary {
  display: grid;
  gap: 0;
  margin: 0;
}

.history-summary div {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.history-summary div:last-child {
  border-bottom: 0;
}

.history-summary dd {
  font-size: 1.35rem;
}

.relay-ledger {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.relay-ledger[hidden] {
  display: none;
}

.relay-label {
  color: var(--leaf);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-decoration-color: rgba(226, 190, 103, 0.42);
  text-underline-offset: 0.22em;
}

.relay-ledger span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.relay-ledger strong {
  color: var(--lichen);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.onchain-ledger {
  grid-column: 1 / -1;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.onchain-ledger[hidden] {
  display: none;
}

.onchain-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.onchain-head span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.onchain-head strong {
  color: var(--lichen);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.onchain-ledger dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 1rem 0 0;
  border: 1px solid var(--line);
}

.onchain-ledger dl div {
  min-width: 0;
  padding: 0.8rem;
  border-right: 1px solid var(--line);
}

.onchain-ledger dl div:last-child {
  border-right: 0;
}

.onchain-ledger dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.onchain-ledger dd {
  margin: 0.38rem 0 0;
  color: var(--leaf);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@keyframes checking {
  0% { box-shadow: 0 0 0 0 rgba(226, 190, 103, 0.48); }
  100% { box-shadow: 0 0 0 0.75rem rgba(226, 190, 103, 0); }
}

@media (max-width: 1050px) {
  .network-dashboard {
    grid-template-columns: minmax(16rem, 0.78fr) minmax(26rem, 1.25fr);
  }

  .history-panel {
    grid-template-columns: minmax(12rem, 0.6fr) minmax(20rem, 1.4fr);
  }

  .history-chart {
    grid-column: 2;
    grid-row: span 2;
  }

  .history-summary {
    grid-column: 1;
    grid-template-columns: repeat(4, 1fr);
  }

  .history-summary div {
    padding: 0.5rem 0.6rem 0 0;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .network-hero {
    min-height: 0;
    margin: 0.5rem;
  }

  .network-dashboard {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 2.2rem 0 1rem;
  }

  .network-copy {
    z-index: 5;
  }

  .network-copy h1 {
    font-size: clamp(3.6rem, 16vw, 5.5rem);
  }

  .network-copy p {
    max-width: 31rem;
    margin-top: 1rem;
  }

  .network-stage {
    width: min(100%, 34rem);
    margin: -0.5rem auto 0;
  }

  .network-visual {
    width: 100%;
    grid-row: auto;
  }

  .network-foot {
    margin-top: 1.25rem;
    padding: 0 0.5rem;
  }

  .provenance-panel {
    grid-column: auto;
    width: 100%;
  }

  .network-data {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: var(--page);
    grid-template-columns: repeat(3, 1fr);
    margin: 0 auto 1rem;
  }

  .history-panel {
    grid-template-columns: 1fr;
  }

  .history-chart,
  .history-summary {
    grid-column: auto;
  }

  .history-chart {
    grid-row: auto;
  }

  .history-summary {
    grid-template-columns: repeat(4, 1fr);
  }

}

@media (max-width: 480px) {
  .network-copy h1 {
    font-size: clamp(3.35rem, 17vw, 4.5rem);
  }

  .network-copy p {
    font-size: 0.86rem;
  }

  .network-stage {
    width: calc(100% + 1rem);
    margin-left: -0.5rem;
  }

  .provenance-panel dl div {
    grid-template-columns: 0.9fr 1.1fr;
  }

  .network-data div {
    padding: 0.72rem 0.75rem;
  }

  .network-data dd {
    font-size: 1.35rem;
  }

  .history-chart svg {
    height: 10.5rem;
  }

  .history-summary dd {
    font-size: 1.2rem;
  }

  .history-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .history-summary div {
    padding-bottom: 0.55rem;
  }

  .relay-ledger {
    align-items: flex-end;
  }

  .relay-ledger strong {
    font-size: 1.3rem;
  }

  .onchain-ledger dl {
    grid-template-columns: 1fr;
  }

  .onchain-ledger dl div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .onchain-ledger dl div:last-child {
    border-bottom: 0;
  }

}

@media (max-width: 360px) {
  .network-page .nav-links a[href="../research/index.html"] {
    display: none;
  }

  .network-page .nav-links {
    gap: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .state-pulse {
    animation: none !important;
  }
}
