/* Hero and the interactive 3D stage */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 78% 12%, rgba(30, 92, 66, .32), transparent 70%),
    radial-gradient(ellipse 45% 45% at 15% 85%, rgba(201, 255, 106, .07), transparent 70%),
    var(--ink);
  color: var(--paper);
  padding-top: 70px;
  min-height: 100svh;
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(180, 220, 197, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 220, 197, .055) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.7) 65%, transparent 100%);
}
.hero::after {
  content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  right: -180px; top: -260px; pointer-events: none;
  background: radial-gradient(circle, rgba(201, 255, 106, .09), transparent 65%);
}
.hero__grid {
  position: relative; z-index: 1;
  width: min(var(--max-wide), 100% - (var(--pad) * 2));
  margin: 0 auto;
  display: grid; grid-template-columns: minmax(360px, .82fr) minmax(0, 1.18fr);
  gap: clamp(32px, 4.5vw, 76px);
  align-items: start;
  padding: clamp(40px, 5vw, 76px) 0 clamp(32px, 4vw, 54px);
}
.hero__copy { padding-top: clamp(8px, 3vw, 42px); min-width: 0; }
.hero__grid > *, .bench-layout > *, .pinout-layout > *, .calc-grid > * { min-width: 0; }
.stage-card, .bench-panel { overflow: hidden; }
.stage-rail-wrap, .board-rail, .stage-foot, .stage-parts { min-width: 0; }
.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font: 500 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  color: #a9bdb2;
}
.eyebrow__line { width: 34px; height: 1px; background: var(--lime); }
.hero h1 {
  margin-top: 22px;
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 6.6vw, 7.5rem);
  line-height: .86; letter-spacing: -.065em; font-weight: 700;
}
.hero h1 em {
  font-family: var(--font-serif); font-weight: 400; font-style: italic;
  letter-spacing: -.035em; color: var(--lime);
  padding-right: .05em;
}
.hero__lead {
  max-width: 470px; margin-top: 26px; color: #b5c5bb;
  font-size: clamp(14px, 1.15vw, 16.5px); line-height: 1.72;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero__stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin-top: clamp(30px, 4vw, 54px); border-top: 1px solid rgba(218, 237, 226, .16);
}
.hero__stats > div { padding: 15px 12px 0 0; }
.hero__stats dt { font: 500 9px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: #7f9488; }
.hero__stats dd {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(1.65rem, 2.3vw, 2.25rem);
  line-height: 1.1; letter-spacing: -.04em; color: var(--paper); margin-top: 3px;
}
.hero__note {
  margin-top: 26px; max-width: 430px; padding-left: 12px;
  border-left: 1px solid rgba(201, 255, 106, .35);
  font-size: 11.5px; line-height: 1.65; color: #83998c;
}
.hero__note .mono { color: var(--lime); font-size: 9px; margin-right: 7px; }

/* stage card */
.stage-card {
  position: relative;
  border: 1px solid rgba(208, 234, 219, .17);
  background: linear-gradient(180deg, rgba(18, 37, 28, .78), rgba(9, 20, 15, .92));
  box-shadow: 0 26px 90px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .04);
  min-height: 520px;
  display: flex; flex-direction: column;
}
.stage-card::before, .stage-card::after {
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none; z-index: 3;
}
.stage-card::before { left: -1px; top: -1px; border-left: 2px solid var(--lime); border-top: 2px solid var(--lime); }
.stage-card::after { right: -1px; bottom: -1px; border-right: 2px solid var(--lime); border-bottom: 2px solid var(--lime); }
.stage-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  padding: 17px 18px 14px; border-bottom: 1px solid rgba(208, 234, 219, .12);
}
.stage-head__title { min-width: 0; }
.stage-kicker {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font: 500 9px var(--font-mono); letter-spacing: .09em; text-transform: uppercase; color: #9fb4a8;
}
.stage-kicker .live-dot { width: 5px; height: 5px; }
.stage-index { color: #5e7768; margin-left: 2px; }
.stage-head h2 {
  font-family: var(--font-display); font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.05; letter-spacing: -.035em; font-weight: 600; margin-top: 6px;
}
.stage-head__title > p:last-child {
  margin-top: 5px; color: #91a599; font-size: 11.5px; line-height: 1.45;
  max-width: 340px;
}
.stage-toolbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; flex: none; max-width: 440px; }
.seg { display: flex; border: 1px solid rgba(208, 234, 219, .18); }
.seg button {
  border: 0; background: transparent; color: #9fb3a7;
  font: 500 9px var(--font-mono); letter-spacing: .04em;
  padding: 7px 8px; border-right: 1px solid rgba(208, 234, 219, .12);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--lime); color: var(--ink); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--lime); background: rgba(201, 255, 106, .07); }
.tool-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid rgba(208, 234, 219, .18); background: transparent; color: #9fb3a7;
  padding: 6px 8px; font: 500 9px var(--font-mono); letter-spacing: .02em;
}
.tool-btn svg { width: 12px; height: 12px; }
.tool-btn:hover { color: var(--lime); border-color: rgba(201, 255, 106, .35); }
.tool-btn[aria-pressed="true"] { color: var(--lime); border-color: rgba(201, 255, 106, .35); background: rgba(201, 255, 106, .06); }

.stage-viewport {
  position: relative; flex: none;
  height: clamp(330px, 34vw, 470px);
  background:
    radial-gradient(ellipse at 52% 44%, rgba(47, 111, 84, .32), transparent 66%),
    linear-gradient(180deg, rgba(6, 16, 11, .2), rgba(5, 14, 10, .55));
  overflow: hidden;
}
.stage-viewport::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(201, 255, 106, .12) .6px, transparent .6px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 76%);
  opacity: .45;
}
#stage-gl { width: 100%; height: 100%; position: relative; z-index: 1; cursor: grab; touch-action: none; }
#stage-gl:active { cursor: grabbing; }
.stage-loading {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(7, 17, 12, .86); font: 500 10px var(--font-mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--lime);
}
.stage-loading span {
  width: 14px; height: 14px; border: 1px solid rgba(201, 255, 106, .25); border-top-color: var(--lime);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.stage-markers { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.marker {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px;
  border: 0; background: none; color: var(--paper); padding: 4px; pointer-events: auto;
  transition: opacity .2s;
}
.marker__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 3px rgba(201, 255, 106, .18), 0 0 12px rgba(201, 255, 106, .55);
  transition: transform .2s, box-shadow .2s;
}
.marker__label {
  font: 500 9px var(--font-mono); letter-spacing: .02em; white-space: nowrap;
  padding: 4px 7px; color: #dbe9df; background: rgba(6, 16, 11, .84);
  border: 1px solid rgba(208, 234, 219, .18); backdrop-filter: blur(6px);
  opacity: .92; transition: border-color .2s, color .2s, background .2s;
}
.marker:hover .marker__dot, .marker.is-active .marker__dot {
  transform: scale(1.4); box-shadow: 0 0 0 4px rgba(201, 255, 106, .22), 0 0 18px rgba(201, 255, 106, .8);
}
.marker:hover .marker__label, .marker.is-active .marker__label {
  border-color: var(--lime); color: var(--lime); background: rgba(8, 23, 16, .96);
}
.stage-markers.labels-off .marker__label { display: none; }
.marker.label-hidden .marker__label { display: none; }
.marker.label-hidden:hover .marker__label { display: inline-block; }
.stage-part-card {
  position: absolute; left: 16px; bottom: 46px; z-index: 5; width: min(300px, 55%);
  padding: 13px 15px; background: rgba(7, 19, 13, .92); border: 1px solid rgba(201, 255, 106, .3);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35); backdrop-filter: blur(10px);
}
.stage-part-card .mono { color: var(--lime); font-size: 8px; }
.stage-part-card strong { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 16px; line-height: 1.2; }
.stage-part-card p { margin-top: 4px; font-size: 11px; line-height: 1.5; color: #a8baae; }
.stage-part-card.is-pulse { animation: pulse-card .5s ease; }
@keyframes pulse-card { 0% { transform: translateY(4px); opacity: .6; } 100% { transform: none; opacity: 1; } }
.stage-chips {
  position: absolute; left: 16px; top: 14px; z-index: 4;
  display: flex; flex-wrap: wrap; gap: 5px; max-width: calc(100% - 32px);
}
.stage-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 2;
  font: 400 8.5px var(--font-mono); letter-spacing: .03em; color: #71877a;
  white-space: nowrap;
}
.stage-foot {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
  padding: 10px 16px; border-top: 1px solid rgba(208, 234, 219, .1);
}
.stage-protocols { display: flex; flex-wrap: wrap; gap: 4px; }
.stage-protocols .tag {
  border-color: rgba(201, 255, 106, .22); color: #cfe3d7; background: rgba(201, 255, 106, .05);
  font-size: 8px; padding: 3px 6px;
}
.stage-parts { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.stage-parts::-webkit-scrollbar { display: none; }
.stage-parts button {
  flex: none; border: 1px solid rgba(208, 234, 219, .12); background: transparent;
  color: #a9bcb0; padding: 4px 7px; font: 500 8.5px var(--font-mono); white-space: nowrap;
}
.stage-parts button span { color: #5d7767; margin-right: 5px; }
.stage-parts button:hover, .stage-parts button.is-active {
  color: var(--lime); border-color: rgba(201, 255, 106, .4); background: rgba(201, 255, 106, .05);
}
.stage-rail-wrap { padding: 0 10px 10px; }
.rail-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 5px 5px 8px; color: #7d9385;
}
.rail-head .mono { font-size: 8px; }
.rail-head a { display: inline-flex; align-items: center; gap: 5px; font: 500 8.5px var(--font-mono); color: #a9bcb0; }
.rail-links { display: flex; align-items: center; gap: 14px; }
.rail-head a#stage-use { color: var(--lime); }
.rail-head a svg { width: 11px; height: 11px; }
.rail-head a:hover { color: var(--lime); }
.board-rail {
  display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin;
  scrollbar-color: rgba(201, 255, 106, .25) transparent;
}
.board-rail::-webkit-scrollbar { height: 4px; }
.board-rail::-webkit-scrollbar-thumb { background: rgba(201, 255, 106, .25); }
.rail-btn {
  flex: none; width: 132px; text-align: left; padding: 8px 9px;
  border: 1px solid rgba(208, 234, 219, .12); background: rgba(255, 255, 255, .015);
  color: #a7baae; display: grid; grid-template-columns: auto 1fr; gap: 1px 8px;
  transition: border-color .2s, background .2s, color .2s;
}
.rail-btn__n { grid-row: span 2; font: 500 8px var(--font-mono); color: #577063; align-self: center; }
.rail-btn__name { font: 600 11px var(--font-display); color: #d9e6dd; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-btn__fam { font: 400 8px var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: #688072; }
.rail-btn:hover { border-color: rgba(201, 255, 106, .35); background: rgba(201, 255, 106, .04); }
.rail-btn.is-active { background: var(--lime); border-color: var(--lime); }
.rail-btn.is-active .rail-btn__n, .rail-btn.is-active .rail-btn__fam { color: rgba(8, 19, 14, .6); }
.rail-btn.is-active .rail-btn__name { color: var(--ink); }

/* ticker */
.ticker {
  position: relative; z-index: 1; overflow: hidden;
  border-top: 1px solid rgba(201, 255, 106, .35);
  background: var(--lime); color: var(--ink);
  padding: 9px 0;
}
.ticker__track {
  display: flex; align-items: center; gap: 0; width: max-content;
  animation: ticker 38s linear infinite;
  font: 600 10px var(--font-mono); letter-spacing: .12em; white-space: nowrap;
}
.ticker__track span { padding: 0 20px; }
.ticker__track i { width: 4px; height: 4px; background: var(--ink); border-radius: 50%; opacity: .55; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* fullscreen stage */
.stage-card:fullscreen {
  background: var(--ink); padding: 0; width: 100vw; height: 100vh;
  display: flex; flex-direction: column; border: 0;
}
.stage-card:fullscreen .stage-head { padding: 18px 24px; }
.stage-card:fullscreen .stage-viewport { flex: 1 1 auto; height: auto; }
.stage-card:fullscreen .stage-foot { flex: none; }
.stage-card:fullscreen .stage-rail-wrap { flex: none; }
