#orbit {
  width: min(100cqw, 100cqh);
  max-width: 100%;
  aspect-ratio: 1;
  flex: none;
  margin: auto;
  container-type: inline-size;
  direction: ltr;
}

/* Service colours, shared by the orbit, the directory and the bottom readout. */
[data-service] { --swatch: #001a70; }
[data-service="wejhaty"] { --swatch: #ff6c0e; }
[data-service="logistics"] { --swatch: #00abc8; }
[data-service="bus"] { --swatch: #eb0045; }
[data-service="hub"] { --swatch: #f5b335; }
[data-service="metro"] { --swatch: #e5e1e6; }

/* Two-tone icons: the soft layer takes the service colour. */
.ph .duo { fill: var(--duo, currentColor); opacity: var(--duo-alpha, .22); transition: opacity .3s ease; }

.tirhal-orbit-stage {
  --ink: var(--brand-dark, #001a70);
  --accent: var(--orbit-accent, #ff6c0e);
  --neutral: #e5e1e6;
  --flow: var(--accent);
  --core-size: clamp(66px, 23.3cqi, 198px);
  --spring: var(--ease-spring, cubic-bezier(.34, 1.56, .64, 1));
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}
.tirhal-orbit-stage[data-level="service"] { --flow: var(--swatch); }
.tirhal-orbit-stage[data-service="metro"] { --flow: #8f95a3; }

/* ---------- guides ---------- */
.tirhal-orbit-guides, .tirhal-orbit-guides > svg,
.tirhal-orbit-ambient, .tirhal-orbit-rotor, .tirhal-orbit-spokes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.tirhal-orbit-guides circle, .tirhal-spoke { vector-effect: non-scaling-stroke; }
.tirhal-outer-guide { stroke: var(--neutral); stroke-width: 1; }
.tirhal-main-guide { stroke: color-mix(in srgb, var(--neutral) 68%, var(--ink)); stroke-width: 1; stroke-dasharray: 2 5; }
.tirhal-mid-guide { stroke: color-mix(in srgb, var(--neutral) 82%, var(--ink)); stroke-width: 1; stroke-dasharray: 1 5; stroke-linecap: round; }
.tirhal-inner-guide { stroke: var(--flow); stroke-width: 1; opacity: .4; transition: stroke .5s ease; }
.tirhal-guide-marks { fill: color-mix(in srgb, var(--neutral) 75%, var(--ink)); }
.tirhal-guides-drift { animation: tirhal-spin 240s linear infinite reverse; }

/* ---------- ambient life: comet, pulses, data packets ---------- */
.tirhal-orbit-ambient { transition: opacity .6s ease; }
.tirhal-orbit-comet {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(66.6% + 3px);
  aspect-ratio: 1;
  translate: -50% -50%;
  animation: tirhal-spin 13s linear infinite;
}
.tirhal-comet-tail {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0turn, transparent 0 .62turn, color-mix(in srgb, var(--flow) 75%, transparent) 1turn);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  transition: opacity .5s;
}
.tirhal-comet-head {
  position: absolute;
  left: 50%;
  top: 1.5px;
  width: clamp(5px, 1.2cqi, 8px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--flow);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--flow) 18%, transparent), 0 0 14px 3px color-mix(in srgb, var(--flow) 40%, transparent);
}
.tirhal-orbit-pulse, .tirhal-orbit-shock {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--core-size);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--flow) 55%, transparent);
  opacity: 0;
  pointer-events: none;
}
.tirhal-orbit-pulse { animation: tirhal-pulse 4.4s cubic-bezier(.25, .6, .35, 1) 1.3s infinite; }
.tirhal-orbit-pulse + .tirhal-orbit-pulse { animation-delay: 3.5s; }
.tirhal-orbit-shock { border-width: 2px; border-color: color-mix(in srgb, var(--flow) 70%, transparent); }

.tirhal-spoke {
  transform-box: view-box;
  transform-origin: 50% 50%;
  stroke: color-mix(in srgb, var(--neutral) 85%, var(--ink));
  stroke-width: 1.2;
  transition: stroke .35s ease, stroke-width .35s ease;
}
.tirhal-orbit-stage[data-level="service"] .tirhal-spoke { stroke: color-mix(in srgb, var(--neutral) 55%, var(--ink)); stroke-width: 1.5; }
.tirhal-orbit-stage .tirhal-spoke.is-active { stroke: var(--flow); stroke-width: 2.2; }
.tirhal-packet {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(6px, 1.9cqi, 12px);
  height: clamp(3px, .75cqi, 5px);
  translate: -50% -50%;
  border-radius: 99px;
  background: var(--flow);
  box-shadow: 0 0 6px color-mix(in srgb, var(--flow) 55%, transparent);
  opacity: 0;
  pointer-events: none;
  animation: tirhal-packet 3.6s cubic-bezier(.45, 0, .3, 1) infinite;
  animation-delay: calc(var(--i) / var(--n) * 3.6s + 1.2s);
}
.tirhal-packet.is-active { animation-duration: 1.6s; animation-delay: 0s; }

.tirhal-orbit-stage:not([data-motion="true"]) .tirhal-orbit-ambient { opacity: 0; }
.tirhal-orbit-stage:not([data-motion="true"]) :is(.tirhal-orbit-ambient *, .tirhal-packet, .tirhal-guides-drift) { animation-play-state: paused; }
.tirhal-orbit-stage:not([data-motion="true"]) .tirhal-orbit-core::after { animation-play-state: paused; }
.tirhal-orbit-stage:not([data-motion="true"]) .tirhal-packet { visibility: hidden; }

/* ---------- satellites ---------- */
.tirhal-orbit-rotor { will-change: transform; }
.tirhal-orbit-slot { position: absolute; width: 0; height: 0; }
.is-leaving, .is-leaving * { pointer-events: none !important; }

.tirhal-orbit-node, .tirhal-orbit-core {
  --node-ink: color-mix(in srgb, var(--swatch) 62%, black);
  --node-fill: color-mix(in srgb, var(--swatch) 12%, white);
  --node-line: color-mix(in srgb, var(--swatch) 30%, white);
  --duo: var(--swatch);
  --duo-alpha: .3;
  position: absolute;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  font: inherit;
  line-height: 1;
  text-align: center;
  letter-spacing: normal;
  text-transform: none;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tirhal-orbit-stage [data-service="taxi"] { --node-ink: var(--swatch); }
.tirhal-orbit-stage [data-service="metro"] {
  --node-ink: color-mix(in srgb, var(--swatch) 40%, black);
  --node-fill: color-mix(in srgb, var(--swatch) 65%, white);
  --node-line: var(--swatch);
  --duo: #8f95a3;
}
.tirhal-orbit-icon {
  display: grid;
  width: 100%;
  place-items: center;
  pointer-events: none;
}
.tirhal-orbit-icon svg, .tirhal-orbit-icon img {
  display: block;
  max-width: 100%;
  object-fit: contain;
}
.tirhal-orbit-caption { display: grid; justify-items: center; gap: 2px; }
.tirhal-orbit-name { display: block; font-weight: 750; line-height: 1.3; }
.tirhal-orbit-en {
  display: none;
  color: color-mix(in srgb, var(--ink) 76%, white);
  font-family: inherit;
  font-size: clamp(.78rem, 1.95cqi, 1.02rem);
  font-weight: 500;
  line-height: 1.12;
}

.tirhal-orbit-node {
  --size: clamp(38px, 13.2cqi, 118px);
  left: 0;
  top: 0;
  width: var(--size);
  height: var(--size);
  color: var(--node-ink);
  background: var(--node-fill);
  border: 1.5px solid var(--node-line);
  box-shadow: 0 4px 12px rgb(0 26 112 / 9%), 0 0 0 4px rgb(255 255 255 / 78%);
  transition: scale .55s var(--spring), box-shadow .3s ease, background-color .3s ease;
}
.tirhal-orbit-node .tirhal-orbit-icon svg { width: 50%; height: auto; }
.tirhal-orbit-node .tirhal-orbit-icon img { width: 80%; max-height: calc(var(--size) * .72); height: auto; }
.tirhal-orbit-node[data-has-logo] { background: white; }
.tirhal-orbit-node .tirhal-orbit-caption {
  position: absolute;
  left: 50%;
  top: calc(100% + clamp(3px, .7cqi, 7px));
  translate: -50% 0;
  width: max-content;
  max-width: 30cqi;
  padding: 0 .22em;
  border-radius: .3em;
  color: var(--ink);
  background: var(--orbit-label-bg, rgb(255 255 255 / 88%));
  font-size: clamp(.83rem, 3.1cqi, 1.5rem);
}
.tirhal-orbit-node[aria-pressed="true"] {
  --duo-alpha: .55;
  box-shadow: 0 0 0 2px white, 0 0 0 4.5px var(--flow), 0 8px 20px rgb(0 26 112 / 16%);
}
.tirhal-orbit-node:active { scale: .93; transition-duration: .15s, .3s, .3s; }
@media (hover: hover) and (pointer: fine) {
  .tirhal-orbit-node:hover {
    --duo-alpha: .5;
    scale: 1.09;
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent), 0 10px 24px rgb(0 26 112 / 16%);
  }
  .tirhal-orbit-node[aria-pressed="true"]:hover { box-shadow: 0 0 0 2px white, 0 0 0 4.5px var(--flow), 0 10px 24px rgb(0 26 112 / 18%); }
  .tirhal-orbit-core:hover { scale: 1.035; }
}

/* ---------- core ---------- */
.tirhal-orbit-core {
  top: 50%;
  left: 50%;
  z-index: 2;
  width: var(--core-size);
  height: var(--core-size);
  flex-direction: column;
  gap: clamp(3px, .85cqi, 8px);
  background: var(--ink);
  color: white;
  border: 2px solid white;
  outline: 1px solid var(--flow);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px var(--brand-soft, var(--neutral)), 0 6px 18px rgb(0 26 112 / 16%);
  transition: scale .5s var(--spring), box-shadow .3s ease;
}
.tirhal-orbit-core[data-service="pay"] { --duo: var(--accent); --duo-alpha: .85; }
.tirhal-orbit-core:not([data-service="pay"]) { background: var(--node-fill); color: var(--ink); }
.tirhal-orbit-core[data-has-logo] { background: white; color: var(--ink); }
.tirhal-orbit-core::after {
  content: "";
  position: absolute;
  width: clamp(7px, 1.6cqi, 12px);
  aspect-ratio: 1;
  top: 7%;
  right: 5%;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent);
  animation: tirhal-beat 2.6s ease-in-out infinite;
}
.tirhal-orbit-core:active { scale: .97; }
.tirhal-orbit-core .tirhal-orbit-icon { color: inherit; }
.tirhal-orbit-core .tirhal-orbit-icon svg { width: 34%; height: auto; }
.tirhal-orbit-core .tirhal-orbit-icon img { width: 68%; max-height: calc(var(--core-size) * .4); height: auto; }
.tirhal-orbit-core .tirhal-orbit-caption { max-width: 95%; padding-inline: 2px; }
.tirhal-orbit-core .tirhal-orbit-name { font-size: clamp(.85rem, 3.5cqi, 1.68rem); }
.tirhal-orbit-core .tirhal-orbit-en { color: currentColor; opacity: .85; }
.tirhal-orbit-node:focus-visible, .tirhal-orbit-core:focus-visible {
  outline: 3px solid var(--brand, #001a70);
  outline-offset: 5px;
}

@keyframes tirhal-spin { to { rotate: 1turn; } }
@keyframes tirhal-pulse {
  0% { transform: scale(1); opacity: .6; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes tirhal-packet {
  0% { transform: translateX(14.5cqi) scaleX(.4); opacity: 0; }
  7% { opacity: 1; }
  38% { opacity: 1; }
  46%, 100% { transform: translateX(26.5cqi); opacity: 0; }
}
@keyframes tirhal-beat { 50% { transform: scale(1.3); } }

@container (min-width: 440px) {
  .tirhal-orbit-en { display: block; }
}
@container (max-width: 310px) {
  .tirhal-orbit-stage { width: 94%; height: 94%; top: 3%; left: 3%; }
  .tirhal-orbit-node .tirhal-orbit-caption { font-size: .79rem; }
  .tirhal-orbit-core .tirhal-orbit-name { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tirhal-orbit-ambient, .tirhal-packet { display: none; }
  .tirhal-guides-drift, .tirhal-orbit-core::after { animation: none; }
  .tirhal-orbit-node, .tirhal-orbit-core { transition: box-shadow .2s ease; }
  .tirhal-orbit-node:active, .tirhal-orbit-core:active { scale: none; }
}
