/* ============================================================================
   HERO — CONNECTED SERVICES VIDEO NETWORK (right-side hero showcase)
   Isolated component. Every selector is scoped under .hero-video-network so
   nothing here can collide with the rest of the site's CSS. Lives inside the
   existing .sk-hero-figure wrapper — see index.html + the comment above
   js/hero-video-network.js for the integration notes.

   GEOMETRY — one source of truth, no per-item pixel positions:
   - .hero-video-network is a size container; every size below derives from
     its width (cqw), so the circle scales with the column, never the viewport.
   - --hvn-orbit   orbit DIAMETER. The canvas is exactly this big and square,
                   so the orbit is the canvas's inscribed circle:
                   centre = (50%, 50%), radius = 50% of the canvas.
   - --hvn-count   number of services (set by JS from the data array).
   - --hvn-i       a node's index (set by JS). Angle, clockwise from 12 o'clock:
                   --hvn-angle = i * 1turn / count   (10 services -> 36deg)
   - Position:     left = 50% + sin(angle) * 50%
                   top  = 50% - cos(angle) * 50%
     Nodes are sized to the thumbnail only, so the thumbnail's centre sits
     exactly on the orbit; the label hangs off the node on its outward side.
     Connector dots reuse the same formula at i + 0.5.
   - --hvn-node    thumbnail diameter (a fixed fraction of the orbit).
   - --hvn-label-w / --hvn-gap   label width + icon-to-label offset.

   Two label modes, picked by container width (not viewport):
   - "side" (wide):     labels beside the icon on the left/right halves,
                        above/below at 12 and 6 o'clock — matches the design.
   - "compact" (narrow, <560px): every label above (upper half) or below
                        (lower half) its icon, so the ring can use nearly the
                        full width on phones / the 992-1199 laptop column.
   ============================================================================ */

/* Extra room on the right for large screens: the reference design lets the
   circle use part of the empty margin outside the 1320px container. Shared
   by the doodle labels (css/newstyle.css) so they move with the circle. */
#hero .slider-one_image-column {
  --hvn-bleed: 0px;
}

@media (min-width: 1200px) {
  #hero .slider-one_image-column {
    --hvn-bleed: clamp(0px, (100vw - 1320px) / 2 - 48px, 170px);
  }
}

.hero-video-network {
  --hvn-ink: #071a2e;
  --hvn-deep: #0a1c30;
  --hvn-accent: #044a9e;
  --hvn-accent-bright: #1c6fd0;
  --hvn-glow: 38, 132, 229;
  --hvn-white: #ffffff;

  container-type: inline-size;
  position: relative;
  width: calc(100% + var(--hvn-bleed, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-video-network__canvas {
  /* Declared here (not on the container) so the @container overrides
     below re-resolve the orbit/node sizes from the new label metrics. */
  /* label metrics (side mode defaults) */
  --hvn-label-w: 118px;
  --hvn-label-fs: 0.8rem;
  --hvn-gap: 10px;
  --hvn-orbit-max: 540px;
  /* orbit: whatever is left after reserving label room on both sides.
     Horizontal extent of the ring incl. labels =
     orbit * (sin72deg + node/orbit) + 2 * (label + gap) ~= orbit * 1.1 + ... */
  --hvn-orbit: min(var(--hvn-orbit-max),
      calc((100cqw - 2 * (var(--hvn-label-w) + var(--hvn-gap)) - 12px) / 1.1));
  --hvn-node: clamp(30px, calc(var(--hvn-orbit) * 0.145), 80px);
  /* central image + its glowing ring, as fractions of the orbit */
  --hvn-stage: 0.62;
  /* extra push for the 12 / 6 o'clock labels (compact mode only) */
  --hvn-pole-extra: 0px;

  position: relative;
  width: var(--hvn-orbit);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  font-size: var(--hvn-label-fs);
  /* vertical room for the 12 and 6 o'clock labels (2 lines) */
  margin-block: calc(var(--hvn-node) / 2 + var(--hvn-gap) + var(--hvn-pole-extra) + 2.6em);
}

/* ----------------------------------------------------------------------
   Orbit ring + connector dots
   ---------------------------------------------------------------------- */
.hero-video-network__orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(95, 177, 255, 0.42);
  box-shadow:
    0 0 10px rgba(var(--hvn-glow), 0.28),
    inset 0 0 10px rgba(var(--hvn-glow), 0.18);
  z-index: 1;
  pointer-events: none;
}

/* A single soft light travelling along the orbit — one composited
   transform: rotate() animation, nothing recalculated per frame. */
.hero-video-network__orbit-sweep {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      rgba(95, 177, 255, 0) 0deg,
      rgba(95, 177, 255, 0) 280deg,
      rgba(140, 200, 255, 0.95) 360deg);
  -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));
  animation: hvnSweep 22s linear infinite;
  will-change: transform;
}

@keyframes hvnSweep {
  to {
    transform: rotate(1turn);
  }
}

.hero-video-network__dots {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* Shared ring placement — nodes and dots use the exact same formula. */
.hero-video-network__dot,
.hero-video-network__node {
  --hvn-angle: calc(var(--hvn-i, 0) * 1turn / var(--hvn-count, 10));
  position: absolute;
  left: calc(50% + sin(var(--hvn-angle)) * 50%);
  top: calc(50% - cos(var(--hvn-angle)) * 50%);
  transform: translate(-50%, -50%);
}

.hero-video-network__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5fb1ff;
  box-shadow: 0 0 0 2px rgba(var(--hvn-glow), 0.25), 0 0 8px rgba(95, 177, 255, 0.85);
}

/* ----------------------------------------------------------------------
   Service nodes (icon + label = one unit)
   ---------------------------------------------------------------------- */
.hero-video-network__nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.hero-video-network__node {
  width: var(--hvn-node);
  height: var(--hvn-node);
  background: none;
  border: 0;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  animation: hvnNodeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(0.35s + var(--hvn-i, 0) * 0.06s);
}

/* One-off entrance: opacity + the independent `scale` property, so it never
   fights the translate() that keeps the node centred on the orbit. */
@keyframes hvnNodeIn {
  from {
    opacity: 0;
    scale: 0.6;
  }
}

.hero-video-network__node-thumb {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hvn-deep);
  border: 2px solid rgba(95, 177, 255, 0.75);
  box-shadow:
    0 0 0 3px rgba(10, 28, 48, 0.85),
    0 0 14px rgba(var(--hvn-glow), 0.55),
    0 6px 16px rgba(2, 10, 20, 0.45);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.hero-video-network__node-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-video-network__node-label {
  position: absolute;
  width: max-content;
  max-width: var(--hvn-label-w);
  font-size: 1em;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.92);
  white-space: normal;
  text-shadow: 0 1px 8px rgba(2, 10, 20, 0.6);
  pointer-events: none;
  transition: color 0.35s ease;
}

/* Label direction follows the node's side of the circle (set by JS from
   the same angle). */
.hero-video-network__node--right .hero-video-network__node-label {
  left: calc(100% + var(--hvn-gap));
  top: 50%;
  transform: translateY(-50%);
  text-align: left;
}

.hero-video-network__node--left .hero-video-network__node-label {
  right: calc(100% + var(--hvn-gap));
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
}

.hero-video-network__node--top .hero-video-network__node-label {
  bottom: calc(100% + var(--hvn-gap) * 0.6 + var(--hvn-pole-extra));
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.hero-video-network__node--bottom .hero-video-network__node-label {
  top: calc(100% + var(--hvn-gap) * 0.6 + var(--hvn-pole-extra));
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.hero-video-network__node:hover .hero-video-network__node-thumb,
.hero-video-network__node:focus-visible .hero-video-network__node-thumb {
  transform: scale(1.06);
  border-color: #8cc8ff;
  box-shadow: 0 0 0 3px rgba(10, 28, 48, 0.85), 0 0 18px rgba(95, 177, 255, 0.6);
}

.hero-video-network__node:hover .hero-video-network__node-label,
.hero-video-network__node:focus-visible .hero-video-network__node-label {
  color: var(--hvn-white);
}

.hero-video-network__node:focus-visible {
  outline: 2px solid var(--hvn-accent-bright);
  outline-offset: 4px;
}

/* Active service: a calm, static highlight — no continuous pulsing. */
.hero-video-network__node.is-active .hero-video-network__node-thumb {
  transform: scale(1.1);
  border-color: #8cc8ff;
  box-shadow:
    0 0 0 3px rgba(10, 28, 48, 0.85),
    0 0 0 5px rgba(var(--hvn-glow), 0.45),
    0 0 22px rgba(95, 177, 255, 0.65);
}

.hero-video-network__node.is-active .hero-video-network__node-label {
  color: var(--hvn-white);
}

/* ----------------------------------------------------------------------
   Central video stage
   ---------------------------------------------------------------------- */
.hero-video-network__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--hvn-stage) * 100%);
  aspect-ratio: 1 / 1;
  z-index: 3;
}

/* Glowing blue ring around the image (track) + the 5s progress arc. */
.hero-video-network__progress {
  position: absolute;
  inset: -9%;
  width: 118%;
  height: 118%;
  transform: rotate(-90deg);
  pointer-events: none;
  overflow: visible;
}

.hero-video-network__progress-track {
  fill: none;
  stroke: #1f7be0;
  /* stroke-width: 2.6; */
  filter: drop-shadow(0 0 3px rgba(var(--hvn-glow), 0.9));
}

.hero-video-network__progress-fill {
  fill: none;
  stroke: #a9dbff;
  /* stroke-width: 2.6; */
  stroke-linecap: round;
  stroke-dasharray: 345.575;
  stroke-dashoffset: 345.575;
}

.hero-video-network__progress-fill.is-running {
  animation: hvnProgress linear forwards;
  animation-duration: var(--hvn-cycle, 5000ms);
}

.hero-video-network__progress-fill.is-paused {
  animation-play-state: paused;
}

@keyframes hvnProgress {
  from {
    stroke-dashoffset: 345.575;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.hero-video-network__video-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hvn-deep);
  border: 2px solid rgba(148, 197, 255, 0.55);
  box-shadow:
    0 0 0 5px rgba(10, 28, 48, 0.7),
    0 0 30px rgba(var(--hvn-glow), 0.4),
    0 18px 40px rgba(2, 10, 20, 0.55);
}

.hero-video-network__videos {
  position: absolute;
  inset: 0;
}

.hero-video-network__videos video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.6s ease, transform 0.7s ease;
}

.hero-video-network__videos video.is-active {
  opacity: 1;
  transform: scale(1);
  z-index: 1;
}

.hero-video-network__fallback {
  position: absolute;
  inset: 0;
  display: none;
  background: var(--hvn-deep);
}

.hero-video-network__fallback-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-video-network__video-mask.is-fallback .hero-video-network__fallback {
  display: block;
}

.hero-video-network__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 26, 46, 0.02) 0%, rgba(7, 26, 46, 0.08) 60%, rgba(4, 14, 26, 0.7) 100%);
  z-index: 2;
}

.hero-video-network__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: clamp(44px, 14%, 64px);
  height: clamp(44px, 14%, 64px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  color: var(--hvn-ink);
  border: 0;
  font-size: clamp(0.95rem, 4%, 1.3rem);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(2, 10, 20, 0.4);
  transition: transform 0.3s ease, background 0.3s ease;
}

.hero-video-network__play:hover,
.hero-video-network__play:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--hvn-white);
}

.hero-video-network__play:focus-visible {
  outline: 2px solid var(--hvn-accent-bright);
  outline-offset: 3px;
}

.hero-video-network__caption {
  position: absolute;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  z-index: 4;
  width: 82%;
  text-align: center;
  pointer-events: none;
}

.hero-video-network__caption-title {
  display: block;
  color: var(--hvn-white);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: clamp(0.68rem, 3.4%, 0.98rem);
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero-video-network__caption-time {
  display: block;
  margin-top: 4px;
  color: rgba(210, 230, 255, 0.85);
  font-size: clamp(0.6rem, 2.6%, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Prev / next — centred under the image, inside its lower edge. */
.hero-video-network__controls {
  position: absolute;
  left: 50%;
  bottom: 3%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 10px;
}

.hero-video-network__nav {
  --hvn-nav: clamp(28px, calc(var(--hvn-orbit) * 0.075), 40px);
  width: var(--hvn-nav);
  height: var(--hvn-nav);
  border-radius: 50%;
  border: 1px solid rgba(148, 197, 255, 0.45);
  background: rgba(10, 28, 48, 0.88);
  color: var(--hvn-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.hero-video-network__nav i {
  display: flex;
}

.hero-video-network__nav:hover,
.hero-video-network__nav:focus-visible {
  background: var(--hvn-accent);
  border-color: var(--hvn-accent-bright);
  transform: translateY(-2px);
}

.hero-video-network__nav:focus-visible {
  outline: 2px solid var(--hvn-accent-bright);
  outline-offset: 2px;
}

/* ----------------------------------------------------------------------
   Responsive — container-driven (width of the hero's right column)
   ---------------------------------------------------------------------- */

/* Narrower two-column / tablet widths: slightly smaller labels. */
@container (max-width: 699px) {
  .hero-video-network__canvas {
    --hvn-label-w: 94px;
    --hvn-label-fs: 0.74rem;
    --hvn-gap: 8px;
  }
}

@container (max-width: 619px) {
  .hero-video-network__canvas {
    --hvn-label-w: 86px;
    --hvn-label-fs: 0.71rem;
  }
}

/* Compact mode: labels stack above (upper half) / below (lower half) the
   icon, so only half a label width is needed beside the ring:
   horizontal extent = orbit * sin72deg + label / 2. */
@container (max-width: 559px) {
  .hero-video-network__canvas {
    --hvn-label-w: 92px;
    --hvn-label-fs: 0.7rem;
    --hvn-gap: 6px;
    --hvn-stage: 0.58;
    --hvn-pole-extra: 8px;
    --hvn-orbit: min(var(--hvn-orbit-max), calc((100cqw - var(--hvn-label-w) - 8px) / 0.951));
    --hvn-node: clamp(30px, calc(var(--hvn-orbit) * 0.13), 60px);
  }

  .hero-video-network__node--upper .hero-video-network__node-label,
  .hero-video-network__node--lower .hero-video-network__node-label {
    left: 50%;
    right: auto;
    text-align: center;
  }

  .hero-video-network__node--upper .hero-video-network__node-label {
    top: auto;
    bottom: calc(100% + var(--hvn-gap));
    transform: translateX(-50%);
  }

  .hero-video-network__node--lower .hero-video-network__node-label {
    bottom: auto;
    top: calc(100% + var(--hvn-gap));
    transform: translateX(-50%);
  }

  /* the 12 / 6 o'clock labels sit just outside their diagonal
     neighbours' (stacked) labels */
  .hero-video-network__node--top.hero-video-network__node--upper .hero-video-network__node-label {
    bottom: calc(100% + var(--hvn-gap) + var(--hvn-pole-extra));
  }

  .hero-video-network__node--bottom.hero-video-network__node--lower .hero-video-network__node-label {
    top: calc(100% + var(--hvn-gap) + var(--hvn-pole-extra));
  }

  .hero-video-network__dot {
    width: 5px;
    height: 5px;
  }
}

@container (max-width: 379px) {
  .hero-video-network__canvas {
    --hvn-label-w: 70px;
    --hvn-label-fs: 0.6rem;
    --hvn-gap: 4px;
  }

  .hero-video-network__node-label {
    line-height: 1.15;
  }
}

/* Smallest phones: let the ring use the container's side gutters too
   (nothing in it touches the screen edge; labels stay inside). */
@media (max-width: 399.98px) {
  .hero-video-network {
    width: calc(100% + 24px);
    margin-inline: -12px;
  }
}

/* ----------------------------------------------------------------------
   Reduced motion
   ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero-video-network__orbit-sweep,
  .hero-video-network__node {
    animation: none !important;
  }

  .hero-video-network__videos video,
  .hero-video-network__node-thumb {
    transition-duration: 0.01ms !important;
  }
}
