/* ==========================================================================
 * Proof of Internet — inner pages
 * --------------------------------------------------------------------------
 * Loaded only by the generated pages under /network, /map, /contribute and so
 * on. styles.css is left alone so the homepage stays directly comparable with
 * the original replica.
 *
 * Everything here is built from the tokens styles.css already defines, and
 * reuses its components (.btn, .pixel-border, [data-pixel-frame], .type-*)
 * rather than introducing a second visual language.
 * ========================================================================== */

/* ---------- page head ---------------------------------------------------- */
.page {
  /* matches the homepage hero offset under the fixed header */
  padding-top: 5rem;
}

.page-head {
  padding-block: 2.25rem 2.5rem;
  border-bottom: 1px solid var(--stone-700);
}
@media (min-width: 768px) {
  .page-head {
    padding-block: 3.5rem 3.25rem;
  }
}
.page-head h1 {
  margin-top: 0.75rem;
  max-width: 18ch;
}
.page-lede {
  margin-top: 1.5rem;
  max-width: 56ch;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* ---------- bands -------------------------------------------------------- */
.band-alt {
  background: var(--stone-800);
  border-block: 1px solid var(--stone-700);
}
.band-head {
  max-width: 44rem;
  margin-bottom: 2.5rem;
}
.band-head h2 {
  margin-top: 0.75rem;
}
.band-head p {
  margin-top: 1rem;
}

/* ---------- card grid ---------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 640px) {
  .card-grid.cols-2,
  .card-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .card-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.card {
  position: relative;
  color: var(--stone-600);
  padding: 10px;
}
.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 1.25rem;
  background: var(--stone-900);
}
.band-alt .card-body {
  background: var(--stone-900);
}
.card-body h3 {
  margin: 0;
}
.card-body > p {
  margin: 0;
  color: var(--stone-400);
}
.card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0.25rem 0 0;
  padding-top: 0.875rem;
  border-top: 1px solid var(--stone-700);
}
.card-meta div {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.card-meta dt,
.card-meta dd {
  margin: 0;
}
.card-link {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--copper-500);
  text-transform: uppercase;
}
.card-link:hover {
  color: var(--copper-400);
}

/* ---------- numbered flow ------------------------------------------------ */
.flow {
  display: grid;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--stone-700);
}
.flow-step {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--stone-700);
}
@media (min-width: 768px) {
  .flow-step {
    grid-template-columns: 4rem 16rem 1fr;
    align-items: baseline;
  }
}
.flow-n {
  color: var(--copper-500);
}
.flow-step h3 {
  margin: 0;
}
.flow-step p {
  margin: 0;
  color: var(--stone-400);
  max-width: 62ch;
}
.flow-step h3 + p {
  grid-column: 2 / -1;
}
@media (min-width: 768px) {
  .flow-step h3 + p {
    grid-column: 3;
  }
}

/* ---------- spec panel --------------------------------------------------- */
.spec {
  position: relative;
  color: var(--stone-600);
  padding: 10px;
  max-width: 44rem;
}
.spec-body {
  background: var(--stone-900);
  padding: 1.5rem;
}
.spec-list {
  display: grid;
  gap: 0;
  margin: 1rem 0 0;
}
.spec-list div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  justify-content: space-between;
  padding-block: 0.75rem;
  border-top: 1px solid var(--stone-700);
}
.spec-list dt,
.spec-list dd {
  margin: 0;
  min-width: 0;
}
.spec-list dd {
  text-align: right;
}

/* ---------- tables ------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--stone-700);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 34rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--stone-700);
  vertical-align: top;
  white-space: nowrap;
}
.data-table td:last-child {
  white-space: normal;
}
.data-table th {
  background: var(--stone-800);
  text-transform: uppercase;
}
.data-table td {
  color: var(--stone-300);
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr:hover td {
  background: var(--stone-800);
}

/* ---------- prose -------------------------------------------------------- */
.prose {
  /* a measure, not a ch count: the pixel body face has a narrow ch */
  max-width: 46rem;
}
.prose h2 {
  margin: 2.5rem 0 0;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose h3 {
  margin: 1.75rem 0 0;
}
.prose p {
  margin: 1rem 0 0;
}
.prose-list {
  /* styles.css resets every list, so the marker is put back here */
  margin: 1rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.6rem;
  list-style: square outside;
}
.prose-list li {
  color: var(--stone-400);
}
.prose-list li::marker {
  color: var(--copper-500);
}

/* ---------- the sample-data marker --------------------------------------- */
.sample-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--copper-600);
  background: var(--copper-800);
  color: var(--copper-300);
  max-width: 68ch;
}
.sample-chip {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--copper-500);
  color: var(--stone-900);
  text-transform: uppercase;
  white-space: nowrap;
}

/* An ornate frame is prepended, not wrapped around the content the way a
   simple one is, so its container has to place it. Same rule styles.css uses
   for .product-demo-frame. */
.map-stage > .pf,
.dash > .pf {
  position: absolute;
  inset: 0;
}

/* ---------- map page ----------------------------------------------------- */
.map-section {
  padding-block: 2.5rem;
}
.map-stage {
  position: relative;
  color: var(--stone-600);
  padding: 12px;
}
.map-inner {
  background: var(--stone-900);
}
.map-bar,
.map-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}
.map-bar {
  border-bottom: 1px solid var(--stone-700);
}
.map-foot {
  border-top: 1px solid var(--stone-700);
}
.map-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
/* when the tabs wrap, the marker goes to the end of the row rather than
   starting a line of its own */
.map-bar > .sample-chip {
  margin-left: auto;
}
.map-tab {
  padding: 0.375rem 0.625rem;
  color: var(--stone-400);
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: 0;
}
.map-tab:hover {
  color: var(--stone-200);
}
.map-tab[aria-pressed='true'] {
  background: var(--stone-800);
  color: var(--copper-500);
}
.map-canvas {
  display: block;
  width: 100%;
  height: clamp(300px, 56vw, 560px);
  touch-action: pan-y;
  cursor: grab;
}
.map-canvas:active {
  cursor: grabbing;
}
.map-legend {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.map-ramp {
  display: flex;
}
.map-ramp i {
  display: block;
  width: 1.5rem;
  height: 0.625rem;
}
.map-readout {
  margin-top: 1rem;
  min-height: 1.5rem;
}
.map-readout:empty {
  display: none;
}
.map-readout dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0.5rem 0 0;
}
.map-readout div {
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}
.map-readout dt,
.map-readout dd {
  margin: 0;
}

/* ---------- contributor dashboard ---------------------------------------- */
.dash {
  position: relative;
  color: var(--stone-600);
  padding: 12px;
}
.dash-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--stone-900);
}

/* ---------- closing call to action --------------------------------------- */
.page-cta {
  border-top: 1px solid var(--stone-700);
}

@media (prefers-reduced-motion: reduce) {
  .map-canvas {
    cursor: default;
  }
}

/* ---------- live network status ------------------------------------------ */
.live {
  position: relative;
  color: var(--stone-600);
  padding: 10px;
  margin-top: 1.5rem;
}
.live-inner { background: var(--stone-900); padding: 1.25rem 1.5rem; }
.live-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-caption);
  font-size: var(--text-caption-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}
.live-chip.on { color: var(--marine-500); }
.live-chip.warn { color: var(--copper-400); }
.live-chip.off { color: var(--stone-400); }
.live-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 1.25rem 0 0;
}
.live-stats div { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.live-stats dt, .live-stats dd { margin: 0; }
.live-note { margin-top: 1rem; max-width: 70ch; }

/* ---------- /connect ----------------------------------------------------- */
.connect-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (min-width: 60rem) {
  .connect-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 3rem;
  }
}
.connect-card {
  position: relative;
  color: var(--stone-600);
  padding: 10px;
}
.connect-body {
  background: var(--stone-900);
  padding: 1.75rem;
}
/* The sign-in mounts here. A minimum height keeps the frame from jumping when
   the library finishes loading. */
.connect-slot {
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 1rem;
}
.connect-stack {
  display: grid;
  gap: 1rem;
}
.connect-stack .page-actions {
  margin-top: 0.5rem;
}
.connect-foot {
  margin-top: 1.25rem;
  min-height: 1.2em;
}
.connect-side {
  display: grid;
  gap: 0.75rem;
}
.connect-side h2:not(:first-child) {
  margin-top: 1rem;
}
