/* ==========================================================================
   BPS Relay — relay.bpshub.dev
   Sits on style.css and app.css (hero, facts, buttons, chapters, the route, explain cards, the
   get-it columns). This file adds the network figure, the layer stack, the listing, the onion,
   the staking cycle, the uses grid and the comparison. One gem per chapter, as everywhere.
   ========================================================================== */

/* ---------- hero: the network ---------- */

.hero-net { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-net figcaption { font-size: 0.74rem; color: var(--ink-3); text-align: center; max-width: 340px; }
.net { display: block; width: 100%; max-width: 460px; height: auto; overflow: visible; }

.net-links path { fill: none; stroke: rgba(196, 210, 232, 0.13); stroke-width: 1; }
.net-nodes circle { fill: #1b2130; stroke: rgba(196, 210, 232, 0.35); stroke-width: 1; }

.net-path { fill: none; stroke: url(#fire); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1.2 1.6; opacity: 0.75; }
.net-comet { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 7 100; stroke-dashoffset: 7; filter: drop-shadow(0 0 4px rgba(207, 224, 255, 0.9)); animation: comet 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
@keyframes comet { 0% { stroke-dashoffset: 7; opacity: 0; } 6% { opacity: 1; } 92% { opacity: 1; } 100% { stroke-dashoffset: -100; opacity: 0; } }

.net-relay rect { fill: #151a25; stroke: rgba(196, 210, 232, 0.45); stroke-width: 1.2; }
.net-relay text { font: 600 10px var(--mono); fill: var(--ink); text-anchor: middle; }
.net-end circle { stroke-width: 1.5; }
.net-end path { stroke-width: 1.5; stroke-linecap: round; }
.net-you circle { fill: rgba(63, 162, 255, 0.14); stroke: #3fa2ff; }
.net-you path { stroke: #9ccfff; }
.net-site circle { fill: rgba(255, 226, 74, 0.12); stroke: #ffe24a; }
.net-site path { stroke: #ffeb8a; }
.net-labels text { font: 500 10.5px var(--mono); fill: var(--ink-3); }

/* ---------- 01: two clients, and the stack ---------- */

.what { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 22px; align-items: center; }
.what-copy p { margin: 16px 0 0; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; background: var(--hair); }
.pair-col { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: rgba(14, 17, 23, 0.92); }
.pair-us { background: linear-gradient(180deg, var(--gem-glow), transparent 90%), rgba(14, 17, 23, 0.92); }
.pair-k { font-family: var(--display); font-size: 1.08rem; font-weight: 600; color: var(--diamond); }
.pair-us .pair-k { color: var(--gem); }
.pair-v { font-size: 0.78rem; color: var(--ink-3); }
.pair ul { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--ink-2); }
.pair li::before { content: "◆"; margin-right: 8px; font-size: 0.6em; vertical-align: 0.2em; color: var(--ink-3); }
.pair-us li::before { color: var(--gem); }

/* The stack: four slabs, the chain at the bottom, light rising through them. */
.stack { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; position: relative; }
.slab {
	display: grid;
	grid-template-columns: 28px 132px 1fr;
	align-items: baseline;
	gap: 12px;
	padding: 14px 16px 14px 12px;
	border-radius: 7px;
	background: linear-gradient(180deg, #1b202c 0%, #151923 55%, #12151e 100%);
	border: 1px solid rgba(255, 255, 255, 0.06);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.55), inset 3px 0 0 var(--edge);
}
.slab.s1 { --edge: color-mix(in srgb, var(--gem) 100%, transparent); }
.slab.s2 { --edge: color-mix(in srgb, var(--gem) 75%, transparent); margin-inline: 10px; }
.slab.s3 { --edge: color-mix(in srgb, var(--gem) 50%, transparent); margin-inline: 20px; }
.slab.s4 { --edge: color-mix(in srgb, var(--gem) 30%, transparent); margin-inline: 30px; }
.slab-n { font: 500 0.62rem var(--mono); color: var(--ink-3); }
.slab-k { font-size: 0.86rem; font-weight: 650; color: var(--ink); }
.slab-v { font-size: 0.8rem; color: var(--ink-2); line-height: 1.45; }

/* ---------- 02: parts ---------- */

.part { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 28px; padding: 24px 22px; align-items: center; }
.part + .part { border-top: 1px solid var(--hair); }
.part-wide { grid-template-columns: 1fr; gap: 6px; padding: 24px 0 0; }
.part-wide > .part-copy { padding: 0 22px; max-width: 760px; }
.part-copy p { margin: 0 0 12px; }
.part-copy .aside { font-size: 0.8rem; color: var(--ink-3); }

.ticks { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 0.86rem; color: var(--ink-2); line-height: 1.5; }
.ticks li { position: relative; padding-left: 24px; }
.ticks li::before { content: ""; position: absolute; left: 3px; top: 0.42em; width: 9px; height: 5px; border-left: 1.6px solid var(--gem); border-bottom: 1.6px solid var(--gem); transform: rotate(-45deg); }

/* A roster listing, drawn as a card from the Discovery tab. */
.listing { margin: 0; border-radius: var(--r); background: linear-gradient(180deg, #161b26, #10131b); border: 1px solid var(--hair-2); box-shadow: 0 30px 50px -30px rgba(0, 0, 0, 0.95), 0 0 0 4px var(--gem-glow); overflow: hidden; }
.listing-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--hair); font-size: 0.78rem; font-weight: 650; color: var(--ink); }
.listing-tag { margin-left: auto; padding: 2px 8px; border-radius: 999px; font: 600 0.62rem var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gem); border: 1px solid color-mix(in srgb, var(--gem) 45%, transparent); }
.listing dl { margin: 0; padding: 6px 0; }
.listing dl div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 7px 16px; align-items: baseline; }
.listing dt { font: 650 0.6rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.listing dd { margin: 0; font-size: 0.84rem; color: var(--ink); }
.listing .mono { font: 0.8rem var(--mono); color: var(--platinum); }
.id-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.66rem; color: var(--ink-2); border: 1px solid var(--hair-3); }
.listing figcaption { padding: 9px 16px 11px; border-top: 1px solid var(--hair); font-size: 0.7rem; color: var(--ink-3); }

/* The onion: what is still sealed when it reaches each stop. */
.onion-route .stop-home .stop-icon { color: #ffe24a; border-color: rgba(255, 226, 74, 0.5); box-shadow: 0 0 0 4px rgba(255, 226, 74, 0.1), 0 10px 22px -14px rgba(0, 0, 0, 0.9); }
.onion-route .stop-phone .stop-icon { color: #9ccfff; border-color: rgba(63, 162, 255, 0.55); box-shadow: 0 0 0 4px rgba(63, 162, 255, 0.12), 0 10px 22px -14px rgba(0, 0, 0, 0.9); }
.onion-route .stop-note { max-width: 17ch; }
.onion { position: relative; display: grid; place-items: center; width: 36px; height: 36px; margin: 2px 0; }
.onion i, .onion b { position: absolute; border-radius: 50%; }
.onion i { border: 1.5px solid var(--gem); }
.onion i:nth-child(1) { inset: 0; }
.onion i:nth-child(2) { inset: 6px; }
.onion i:nth-child(3) { inset: 12px; }
.onion[data-n="3"] i:nth-child(1) { opacity: 0.45; }
.onion[data-n="3"] i:nth-child(2), .onion[data-n="2"] i:nth-child(1) { opacity: 0.7; }
.onion b { width: 6px; height: 6px; background: var(--diamond); box-shadow: 0 0 6px rgba(243, 247, 252, 0.8); }
.onion[data-n="0"] b { background: #ffe24a; box-shadow: 0 0 8px rgba(255, 226, 74, 0.8); }
.onion-route .hop i { background: linear-gradient(90deg, rgba(42, 167, 156, 0.3), rgba(42, 167, 156, 0.6)); }
.onion-route .hop-out i { background: linear-gradient(90deg, rgba(255, 226, 74, 0.3), rgba(255, 226, 74, 0.55)); }
.onion-route .hop-out i::after { background: linear-gradient(90deg, transparent, #fff3b0, transparent); }
.part-wide .explain { padding: 6px 14px 18px; }

/* The staking cycle: four rack units, and a return wire back to the first. */
.cycle { list-style: none; margin: 8px 22px 0; padding: 0 0 34px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; position: relative; counter-reset: cy; }
.cycle li { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 15px; border-radius: 8px; background: linear-gradient(180deg, #1b202c 0%, #151923 55%, #12151e 100%); border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.55); }
.cycle b { font-size: 0.92rem; color: var(--diamond); }
.cycle li > span:not(.cy-n) { font-size: 0.8rem; color: var(--ink-2); line-height: 1.5; }
.cy-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font: 600 0.7rem var(--mono); color: var(--gem); border: 1px solid color-mix(in srgb, var(--gem) 45%, transparent); }
/* arrows between the units */
.cycle li + li::before { content: ""; position: absolute; left: -20px; top: 50%; width: 14px; height: 2px; margin-top: -1px; background: color-mix(in srgb, var(--gem) 60%, transparent); }
.cycle li + li::after { content: ""; position: absolute; left: -10px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-top: 2px solid color-mix(in srgb, var(--gem) 80%, transparent); border-right: 2px solid color-mix(in srgb, var(--gem) 80%, transparent); transform: rotate(45deg); }
/* the wire home, from the last unit back under to the first */
.cycle::after { content: ""; position: absolute; left: 12.5%; right: 12.5%; bottom: 10px; height: 22px; border: 2px dashed color-mix(in srgb, var(--gem) 45%, transparent); border-top: 0; border-radius: 0 0 14px 14px; }
.cycle::before { content: ""; position: absolute; left: calc(12.5% - 5px); bottom: 30px; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid color-mix(in srgb, var(--gem) 70%, transparent); }

/* ---------- 03: what runs on it ---------- */

.uses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.use { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; border-radius: var(--r); background: radial-gradient(220px 120px at 0% 0%, var(--gem-glow), transparent 75%), rgba(255, 255, 255, 0.015); border: 1px solid var(--hair); }
.use-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px; border-radius: 11px; color: var(--gem); background: linear-gradient(180deg, #1b202c, #12151e); border: 1px solid color-mix(in srgb, var(--gem) 40%, transparent); }
.use-icon svg { width: 21px; height: 21px; }
.use p { margin: 0 0 10px; flex: 1; }
.use code { font: 0.84em var(--mono); color: var(--platinum); background: rgba(255, 255, 255, 0.05); padding: 1px 5px; border-radius: 4px; }
.spec { font: 0.7rem var(--mono); color: var(--ink-3); padding-top: 10px; border-top: 1px solid var(--hair); }
.spec-link { color: var(--gem); font-weight: 600; }
.spec-link:hover { color: var(--diamond); }

/* ---------- 04: why ---------- */

.why-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; padding: 24px 22px 8px; align-items: center; }
.why-intro p { margin: 0; }
.pull { margin: 0; padding-left: 18px; border-left: 2px solid var(--gem); font-family: var(--display); font-size: clamp(1.3rem, 1rem + 0.9vw, 1.7rem); line-height: 1.3; color: var(--diamond); }

.compare { margin: 16px 18px 18px; border: 1px solid var(--hair); border-radius: var(--r); overflow: hidden; }
.cmp-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--hair); }
.cmp-row:first-child { border-top: 0; }
.cmp-row > span { padding: 11px 16px; font-size: 0.84rem; line-height: 1.5; }
.cmp-head > span { padding-block: 9px; font: 650 0.62rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); background: rgba(255, 255, 255, 0.02); }
.cmp-head > span:last-child { color: var(--gem); }
.cmp-k { font-weight: 650; color: var(--ink); }
.cmp-old { color: var(--ink-3); }
.cmp-new { color: var(--ink); background: linear-gradient(90deg, var(--gem-glow), transparent 80%); box-shadow: inset 2px 0 0 color-mix(in srgb, var(--gem) 60%, transparent); }

/* ---------- 05: where it stands ---------- */

.state { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); }
.state li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; align-items: baseline; }
.state .led { transform: translateY(1px); }
.relay-site .need { margin-bottom: 18px; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.net-comet { animation: none; opacity: 0; }
}

/* ---------- narrow ---------- */

@media (max-width: 1100px) {
	.uses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.what { grid-template-columns: 1fr; }
	.part { grid-template-columns: 1fr; }
	.part-wide { padding-top: 24px; }
	.cycle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cycle li:nth-child(3)::before, .cycle li:nth-child(3)::after { display: none; }
	.cycle::after, .cycle::before { display: none; }
	.cycle { padding-bottom: 18px; }
	.why-intro { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 900px) {
	.onion-route .stop { align-items: center; }
	.onion-route .onion { order: 3; margin-left: auto; flex: none; }
	.onion-route .stop-note { max-width: none; }
	.onion-route .stop-name { min-width: 92px; }
	.onion-route .hop i { background: linear-gradient(180deg, rgba(42, 167, 156, 0.3), rgba(42, 167, 156, 0.6)); }
	.onion-route .hop-out i { background: linear-gradient(180deg, rgba(255, 226, 74, 0.3), rgba(255, 226, 74, 0.55)); }
	.onion-route .hop-out i::after { background: linear-gradient(180deg, transparent, #fff3b0, transparent); }
	.cmp-row { grid-template-columns: 1fr 1fr; }
	.cmp-k { grid-column: 1 / -1; padding-bottom: 0 !important; }
	.cmp-head > span:first-child { display: none; }
}

@media (max-width: 680px) {
	.what, .part { padding: 18px 16px; }
	.part-wide > .part-copy { padding: 0 16px; }
	.pair { grid-template-columns: 1fr; }
	.slab { grid-template-columns: 22px 1fr; }
	.slab-v { grid-column: 2; }
	.slab.s2, .slab.s3, .slab.s4 { margin-inline: 0; }
	.listing dl div { grid-template-columns: 1fr; gap: 2px; }
	.uses { grid-template-columns: 1fr; padding: 12px; }
	.cycle { grid-template-columns: 1fr; margin: 8px 16px 0; gap: 22px; }
	.cycle li + li::before { left: 50%; top: -17px; width: 2px; height: 12px; margin: 0 0 0 -1px; }
	.cycle li + li::after { left: 50%; top: -9px; margin: 0 0 0 -3px; transform: rotate(135deg); }
	.cycle li:nth-child(3)::before, .cycle li:nth-child(3)::after { display: block; }
	.why-intro { padding: 18px 16px 4px; }
	.compare { margin: 14px 12px 12px; }
	.cmp-row { grid-template-columns: 1fr; }
	.cmp-head { display: none; }
	.cmp-old::before, .cmp-new::before { display: block; font: 650 0.58rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 2px; }
	.cmp-old::before { content: "Today"; color: var(--ink-3); }
	.cmp-new::before { content: "With BPS Relay"; color: var(--gem); }
	.cmp-old, .cmp-new { padding-block: 6px !important; }
	.cmp-new { padding-bottom: 12px !important; }
	.onion-route .stop-name { min-width: 0; }
	.onion-route .stop { flex-wrap: wrap; }
	.state, .need { font-size: 0.84rem; }
}
