/* ==========================================================================
   Nocturne III · xc — "For SSPs & ad exchanges": the Switchboard (a pixel patch bay).
   Reads the night tokens from nl-site.css; card edges from n3-frame.css. Everything is prefixed .xc-.
   ========================================================================== */

/* ---------------------------------------------------------------- section + copy */
.xc { padding-block: clamp(52px, 6vw, 88px) clamp(64px, 7.4vw, 108px); }
.xc-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.xc-sb-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(36px, 4.6vw, 76px); align-items: start; }
.xc-copy { padding-top: clamp(4px, 1vw, 18px); }
.xc-kicker { display: flex; align-items: center; gap: 12px; font: 500 11px/1.4 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: #B9B5D3; }
.xc-kpx { flex: none; width: 6px; height: 6px; margin-right: 9px; background: var(--cyan); box-shadow: 9px 0 0 rgba(69, 202, 255, .38); }
.xc-title { margin: 24px 0 26px; font: 600 clamp(40px, 4.6vw, 68px)/1 var(--f-head); letter-spacing: -.054em; color: var(--fg); }
.xc-title em {
  background: var(--em-bg); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  padding-right: .05em; margin-right: -.05em;
}
.xc-body { font-size: 18px; line-height: 1.62; color: var(--muted); max-width: 470px; }
.xc-ctas { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 34px; }
/* the primary link carries the brand rule; the address keeps a quiet one */
.xc .text-link { border-bottom: 0; padding-bottom: 12px; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: color .25s var(--e), gap .3s var(--e), background-size .3s var(--e); }
.xc .text-link:first-child { color: #ECE8FF; background-image: linear-gradient(90deg, #8FA6FF, #C08BF0 50%, #FF7AD6); }
.xc .text-link:first-child:hover { color: #fff; background-size: 100% 2px; }
.xc .text-link + .text-link { color: #B3AFCB; background-image: linear-gradient(rgba(179, 175, 203, .4), rgba(179, 175, 203, .4)); }
.xc .text-link + .text-link:hover { color: #fff; }

/* the three points */
.xc-points { list-style: none; margin: 34px 0 36px; padding: 0; border-top: 1px solid var(--line); }
.xc-point { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 18px; align-items: start; align-content: start; padding: 18px 0 19px; border-bottom: 1px solid var(--line-soft); }
.xc-point h3 { font: 600 18px/1.25 var(--f-head); letter-spacing: -.028em; color: var(--fg); }
.xc-point p { margin-top: 5px; font-size: 15px; line-height: 1.6; color: var(--muted); }
.xc-pt-ico {
  width: 38px; height: 38px; padding: 10px; overflow: visible; shape-rendering: crispEdges;
  color: #8FA6FF; fill: currentColor; background: rgba(111, 141, 255, .08); box-shadow: inset 0 0 0 1px rgba(143, 166, 255, .22);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.xc-pt-ico path { opacity: .62; }
.xc-pt-ico .xc-pt-hi { opacity: 1; fill: #45CAFF; }
.xc-point:nth-child(2) .xc-pt-ico { color: #C38BF0; background: rgba(155, 72, 224, .09); box-shadow: inset 0 0 0 1px rgba(195, 139, 240, .24); }
.xc-point:nth-child(2) .xc-pt-hi { fill: #FFFFFF; }
.xc-point:nth-child(3) .xc-pt-ico { color: #FF7AD6; background: rgba(255, 47, 191, .08); box-shadow: inset 0 0 0 1px rgba(255, 122, 214, .24); }
.xc-point:nth-child(3) .xc-pt-hi { fill: #FF2FBF; }

/* ---------------------------------------------------------------- the patch bay */
.xc-sb { position: relative; margin: 0; }
.xc-sb-frame {
  --fr-c: 18px;
  --fr-face: radial-gradient(64% 58% at 50% 50%, rgba(98, 58, 200, .17), rgba(98, 58, 200, 0) 72%), #0B0A1D;
  aspect-ratio: 150 / 124; width: 100%;
}
.xc-sb-canvas { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); }

/* HUD tags placed by JS over the patch bay (left/top = anchor; data-place picks the side) */
.xc-tags { position: absolute; inset: 2px; pointer-events: none; }
.xc-tag {
  --tc: #8C88B8;
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 7px;
  font: 500 10px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; color: #B8B4D4;
  transform: translate(-50%, -100%); transition: color .3s, opacity .3s;
}
.xc-tag::before { content: ""; flex: none; width: 5px; height: 5px; background: var(--tc); }
.xc-tag[data-place="right"] { transform: translate(0, -50%); }
.xc-tag[data-place="below"] { transform: translate(-50%, 0); }
.xc-tag[data-place="corner"] { transform: none; }
.xc-tag[hidden] { display: none; }
.xc-tag--core { --tc: #C38BF0; color: #E2D6FF; }
.xc-tag--you { --tc: #45CAFF; color: #CFF3FF; }
.xc-tag.is-hot { color: #fff; }

/* the plug-in button (placed by JS under the "Your exchange" port) */
.xc-plug {
  position: absolute; left: 0; top: 0; z-index: 4; transform: translate(-50%, 0);
  display: inline-flex; align-items: center; gap: 9px; height: 32px; padding: 0 12px 0 10px; border-radius: 2px;
  font: 500 10.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  color: #071422; background: #45CAFF;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 12px 26px -12px rgba(69, 202, 255, .85);
  transition: background-color .25s var(--e), color .25s var(--e), box-shadow .3s var(--e), opacity .3s;
}
.xc-plug:hover { background: #8FE0FF; }
.xc-plug-ico {
  flex: none; width: 10px; height: 10px;
  background: linear-gradient(currentColor, currentColor) 2px 0 / 2px 3px no-repeat, linear-gradient(currentColor, currentColor) 6px 0 / 2px 3px no-repeat,
    linear-gradient(currentColor, currentColor) 0 3px / 10px 4px no-repeat, linear-gradient(currentColor, currentColor) 4px 7px / 2px 3px no-repeat;
}
/* idle: pixel corner brackets blink around the button (the same "plug here" mark as the empty port) */
.xc-plug::after {
  --b: #45CAFF;
  content: ""; position: absolute; inset: -7px; pointer-events: none;
  background:
    linear-gradient(var(--b), var(--b)) 0 0 / 7px 2px, linear-gradient(var(--b), var(--b)) 0 0 / 2px 7px,
    linear-gradient(var(--b), var(--b)) 100% 0 / 7px 2px, linear-gradient(var(--b), var(--b)) 100% 0 / 2px 7px,
    linear-gradient(var(--b), var(--b)) 0 100% / 7px 2px, linear-gradient(var(--b), var(--b)) 0 100% / 2px 7px,
    linear-gradient(var(--b), var(--b)) 100% 100% / 7px 2px, linear-gradient(var(--b), var(--b)) 100% 100% / 2px 7px;
  background-repeat: no-repeat;
  animation: xc-ping 1.25s steps(1) infinite;
}
@keyframes xc-ping { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.xc-plug.is-on { color: #BFF0FF; background: rgba(12, 14, 34, .86); box-shadow: inset 0 0 0 1px rgba(69, 202, 255, .5); }
.xc-plug.is-on:hover { color: #fff; box-shadow: inset 0 0 0 1px #45CAFF; }
.xc-plug.is-on::after, .xc-plug.is-busy::after { animation: none; opacity: 0; }
.xc-plug.is-busy { pointer-events: none; }
.af-paused .xc-plug::after { animation: none; opacity: 1; }
.af-paused .xc-plug.is-on::after { opacity: 0; }

/* ================================================================ responsive */
@media (max-width: 1100px) {
  /* tablet: pitch on top (headline | body + links), the patch bay full width, then the three points */
  .xc-sb-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 48px; row-gap: 0; align-items: end; }
  .xc .xc-copy { display: contents; }
  .xc .xc-kicker { grid-column: 1 / -1; grid-row: 1; }
  .xc .xc-title { grid-column: 1; grid-row: 2 / span 2; margin-bottom: 0; }
  .xc .xc-body { grid-column: 2; grid-row: 2; margin-bottom: 22px; }
  .xc .xc-ctas { grid-column: 2; grid-row: 3; }
  .xc-sb { grid-column: 1 / -1; grid-row: 4; margin-top: clamp(36px, 5vw, 52px); }
  .xc-points { grid-column: 1 / -1; grid-row: 5; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; margin: 38px 0 0; }
  .xc-point { grid-template-columns: minmax(0, 1fr); gap: 14px; border-bottom: 0; padding-bottom: 6px; }
}
@media (max-width: 760px) {
  /* phones: one column; a portrait patch bay right under the pitch, points and links after it */
  .xc-body { font-size: 17px; }
  .xc-sb-grid { grid-template-columns: minmax(0, 1fr); }
  .xc .xc-kicker, .xc .xc-title, .xc .xc-body, .xc .xc-ctas, .xc-sb, .xc-points { grid-column: 1; grid-row: auto; }
  .xc .xc-kicker { order: 1; }
  .xc .xc-title { order: 2; margin: 20px 0 20px; }
  .xc .xc-body { order: 3; margin-bottom: 0; }
  .xc-sb { order: 4; margin-top: 30px; }
  .xc-points { order: 5; display: block; margin: 30px 0 32px; }
  .xc-point { grid-template-columns: 38px minmax(0, 1fr); gap: 16px; border-bottom: 1px solid var(--line-soft); padding: 16px 0 17px; }
  .xc .xc-ctas { order: 6; }
  .xc-sb-frame { aspect-ratio: 84 / 128; --fr-c: 14px; }
}
@media (max-width: 380px) {
  .xc-sb .xc-tag { font-size: 9px; letter-spacing: .06em; gap: 5px; }
  .xc-plug { height: 30px; padding: 0 10px 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .xc-plug::after { animation: none; }
}
