/* ============================================================
   OFFICES — live world map + office cards.
   Copied from refrence/css/contact.css (contact page) so the
   section matches the reference exactly.
   ============================================================ */
:root {
  --pw-line: #e7e9ee;
  --pw-text: #0a0a0f;
  --pw-text-2: #374151;
  --pw-muted: #5b6272;
  --pw-accent-text: #0e74a3;
}

.cp-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.cp-h2 {
  margin-top: 12px;
  font-size: clamp(28px, 3.2vw, 44px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--pw-text);
}

.cp-h2 span {
  color: var(--cyan);
}

.cp-head {
  margin-bottom: clamp(28px, 4vw, 44px);
}

.cp-head__sub {
  margin-top: 12px;
  max-width: 560px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--pw-muted);
}

/* ============================================================
   OFFICES
   ============================================================ */
.cp-offices {
  padding: clamp(64px, 8vw, 110px) 0;
  border-top: 1px dashed #dcdee4;
}

/* ---------- live world map ---------- */
.cp-map {
  margin-bottom: 28px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 70% at 70% 40%, rgba(41, 171, 226, 0.08), transparent 70%),
    #fff;
  border: 1px solid var(--pw-line);
  box-shadow: 0 40px 80px -60px rgba(16, 20, 40, 0.5);
}

.cp-map__canvas {
  position: relative;
  padding: clamp(14px, 2.4vw, 34px) clamp(10px, 2vw, 30px) 6px;
}

/* labels are positioned in % of this box, which is exactly the map drawing */
.cp-map__stage {
  position: relative;
}

.cp-map__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* land: one dotted path (round caps on zero-length segments = dots) */
.cp-map__land {
  fill: none;
  stroke: #c3ccd8;
  stroke-width: 4.2;
  stroke-linecap: round;
}

.cp-map__land--night {
  stroke: #7d8aa0;
}

.cp-map__land--lit {
  stroke: var(--cyan);
}

/* live night side (shape computed in js/contact.js) */
.cp-map__night {
  fill: rgba(26, 39, 68, 0.05);
  filter: blur(10px);
}

/* reveal: land sweeps in from the left */
html.js .cp-map__land {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.8s cubic-bezier(0.65, 0, 0.35, 1);
}

html.js .cp-map__land--lit {
  transition-delay: 0.4s;
}

html.js .cp-map.is-in .cp-map__land {
  clip-path: inset(0 0 0 0);
}

/* routes draw in, then signals travel along them */
.cp-map__arc {
  fill: none;
  stroke: url(#cpArc);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  opacity: 0.85;
  transition: stroke-width 0.3s ease, opacity 0.3s ease;
}

.cp-map.is-in .cp-map__arc {
  animation: cpDraw 1.6s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  animation-delay: calc(1s + var(--i, 0) * 0.35s);
}

@keyframes cpDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.cp-map__signal {
  fill: #fff;
  stroke: var(--cyan);
  stroke-width: 2.5;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(41, 171, 226, 0.9));
  transition: opacity 0.6s ease 2.4s;
}

.cp-map__signal--back {
  fill: var(--cyan);
  stroke: #fff;
  stroke-width: 1.5;
}

.cp-map.is-in .cp-map__signal {
  opacity: 1;
}

/* pins: dot + two expanding rings */
.cp-pin {
  cursor: pointer;
}

.cp-pin__dot {
  fill: var(--black);
  stroke: #fff;
  stroke-width: 2.5;
  transition: r 0.3s ease, fill 0.3s ease;
}

.cp-pin[data-office="in"] .cp-pin__dot {
  fill: var(--cyan);
}

.cp-pin__ring {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: cpRing 2.6s ease-out infinite;
}

.cp-pin__ring--2 {
  animation-delay: -1.3s;
}

@keyframes cpRing {
  from {
    transform: scale(0.8);
    opacity: 0.9;
  }

  to {
    transform: scale(4);
    opacity: 0;
  }
}

html.js .cp-pin {
  opacity: 0;
  transition: opacity 0.5s ease;
}

.cp-map.is-in .cp-pin {
  opacity: 1;
  transition-delay: 0.9s;
}

.cp-map.is-in .cp-pin[data-office="dk"] {
  transition-delay: 1.2s;
}

.cp-map.is-in .cp-pin[data-office="in"] {
  transition-delay: 1.5s;
}

/* labels at the pins (live local time inside) */
.cp-tag {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--pw-line);
  box-shadow: 0 14px 28px -16px rgba(16, 20, 40, 0.45);
  white-space: nowrap;
  cursor: default;
  transition: opacity 0.6s ease, translate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* nudged above or below the pin, with a small pointer */
.cp-tag {
  --dx: 0px;
  --gap: 22px;
}

.cp-tag--up {
  transform: translate(calc(-50% + var(--dx)), calc(-100% - var(--gap)));
}

.cp-tag--down {
  transform: translate(calc(-50% + var(--dx)), var(--gap));
}

.cp-tag::after {
  content: "";
  position: absolute;
  left: calc(50% - var(--dx));
  width: 10px;
  height: 10px;
  margin-left: -5px;
  background: inherit;
  border: inherit;
  rotate: 45deg;
}

.cp-tag--up::after {
  bottom: -6px;
  border-top: 0;
  border-left: 0;
}

.cp-tag--down::after {
  top: -6px;
  border-bottom: 0;
  border-right: 0;
}

.cp-tag b {
  font-size: 14px;
  font-weight: 700;
  color: var(--pw-text);
}

.cp-tag em {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--cyan);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.06em;
  color: #fff;
  vertical-align: 2px;
}

.cp-tag small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--pw-muted);
}

.cp-tag small::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa0ad;
}

.cp-tag.is-open small::before {
  background: #22c55e;
}

.cp-tag i {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

html.js .cp-tag {
  opacity: 0;
  translate: 0 10px;
}

.cp-map.is-in .cp-tag {
  opacity: 1;
  translate: 0 0;
  transition-delay: 1.4s, 1.4s, 0s, 0s, 0s;
}

.cp-map.is-in .cp-tag[data-office="dk"] {
  transition-delay: 1.7s, 1.7s, 0s, 0s, 0s;
}

.cp-map.is-in .cp-tag[data-office="in"] {
  transition-delay: 2s, 2s, 0s, 0s, 0s;
}

/* focus: hovering an office (card, pin or label) highlights it and its routes */
.cp-map.has-focus .cp-map__arc {
  opacity: 0.2;
}

.cp-map.has-focus .cp-map__arc.is-focus {
  opacity: 1;
  stroke-width: 3.6;
}

.cp-map.has-focus .cp-map__signal:not(.is-focus) {
  opacity: 0.15;
  transition-delay: 0s;
}

.cp-pin.is-focus .cp-pin__dot {
  r: 9;
  fill: var(--cyan);
}

.cp-tag.is-focus {
  background: var(--black);
  border-color: var(--black);
  box-shadow: 0 18px 34px -16px rgba(16, 20, 40, 0.7);
}

.cp-tag.is-focus b {
  color: #fff;
}

.cp-tag.is-focus small {
  color: #c4c8d2;
}

.cp-office.is-focus {
  border-color: var(--cyan);
  transform: translateY(-6px);
  box-shadow: 0 30px 50px -32px rgba(41, 171, 226, 0.55);
}

/* bottom bar: legend + stats */
.cp-map__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 14px clamp(16px, 2.4vw, 30px) 18px;
  border-top: 1px dashed #dcdee4;
}

.cp-map__legend,
.cp-map__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--pw-muted);
}

.cp-map__legend li,
.cp-map__stats li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cp-map__stats b {
  font-size: 15px;
  color: var(--pw-text);
}

.cp-lg {
  display: inline-block;
}

.cp-lg--office {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--black);
  box-shadow: 0 0 0 3px rgba(41, 171, 226, 0.3);
}

.cp-lg--route {
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #29abe2, #0e74a3);
}

.cp-lg--night {
  width: 16px;
  height: 10px;
  border-radius: 3px;
  background: rgba(26, 39, 68, 0.18);
}

@media (max-width: 1100px) {
  .cp-tag {
    padding: 6px 10px;
    --gap: 16px;
  }

  .cp-tag b {
    font-size: 12.5px;
  }

  .cp-tag small {
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  .cp-map {
    border-radius: 18px;
  }

  /* room above the map for the top labels */
  .cp-map__canvas {
    padding-top: 40px;
  }

  /* phones: compact labels (time hidden), no stats row */
  .cp-tag {
    padding: 5px 8px;
    border-radius: 7px;
  }

  .cp-tag b {
    font-size: 11px;
  }

  .cp-tag em {
    font-size: 8px;
  }

  .cp-tag small {
    display: none;
  }

  .cp-tag {
    --gap: 12px;
  }

  .cp-map__stats {
    display: none;
  }

  .cp-map__legend {
    font-size: 12px;
    gap: 6px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cp-map__arc {
    stroke-dashoffset: 0;
    animation: none !important;
  }

  html.js .cp-pin,
  html.js .cp-tag {
    opacity: 1;
    translate: none;
  }

  html.js .cp-map__land {
    clip-path: none;
  }

  .cp-map__signal,
  .cp-pin__ring {
    display: none;
  }
}

.cp-office-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.cp-office {
  display: flex;
  flex-direction: column;
  padding: 26px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--pw-line);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease, border-color 0.3s ease;
}

.cp-office:hover {
  transform: translateY(-6px);
  border-color: rgba(41, 171, 226, 0.5);
  box-shadow: 0 30px 50px -32px rgba(16, 20, 40, 0.45);
}

.cp-office__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cp-office__flag {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--black);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.cp-office__badge {
  height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--cyan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.cp-office__badge--soft {
  background: #f1f4f8;
  color: var(--pw-text-2);
}

.cp-office h3 {
  margin-top: 20px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--pw-text);
}

.cp-office__addr {
  /* two lines reserved so the clock rows line up across cards */
  min-height: 3.2em;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--pw-muted);
}

.cp-office__time {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f8fb;
  font-size: 14px;
  color: var(--pw-text-2);
}

.cp-office__time i {
  color: var(--cyan);
}

.cp-office__time b {
  font-size: 16px;
  color: var(--pw-text);
  font-variant-numeric: tabular-nums;
}

.js-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.js-open::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.js-open.is-open {
  color: #15803d;
}

.js-open.is-closed {
  color: #8a90a0;
}

.cp-office__links {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.cp-office__links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--pw-text);
  padding-bottom: 2px;
  background: linear-gradient(var(--cyan), var(--cyan)) no-repeat left bottom / 0% 1.5px;
  transition: background-size 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.cp-office__links a i {
  color: var(--cyan);
  font-size: 12px;
}

.cp-office__links a:hover {
  background-size: 100% 1.5px;
}


@media (max-width: 1199px) {
  .cp-office-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .cp-wrap {
    padding: 0 16px;
  }

  .cp-office-grid {
    grid-template-columns: 1fr;
  }
}

/* grid-paper background, as on the reference contact page */
.cp-offices {
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}
