/**
 * Juno Capital Hong Kong  Spring Application
 *
 * @CopyRights: Boston CodeDX B.V.
 * @Author: Deyu Xu
 */

/* Shared market strip: public pages (with portal.css) and the staff workspace (with style.css).
   Load after the page stylesheet. */

/* Public market overview. */
.market-strip {
  --market-panel: rgba(255, 255, 255, .43);
  --market-copy: #222b32;
  --market-muted: #34444c;
  --market-border: rgba(55, 66, 76, .2);
  --market-up: #22624a;
  --market-down: #963d47;
  --market-gap: clamp(12px, 1.5vw, 22px);
  --market-card-height: 104px;
  --market-history-height: clamp(22px, 2.2vw, 30px);
  --market-preview-height: 86px;
  --market-inline-margin: max(20px, calc((100% - 1800px) / 2));
  position: relative;
  isolation: isolate;
  width: 100%;
  border-bottom: 1px solid var(--market-border);
  background: url('/images/portal-our-firm.webp') center 48% / cover no-repeat;
  color: var(--market-copy);
  font-family: var(--portal-font-sans, var(--font, sans-serif));
}

.market-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(112deg, rgba(247, 252, 252, .64), rgba(230, 242, 246, .52));
  -webkit-backdrop-filter: blur(9px) saturate(.82);
  backdrop-filter: blur(9px) saturate(.82);
  box-shadow: inset 0 1px rgba(255, 255, 255, .68);
}

.market-strip-toggle {
  position: absolute;
  z-index: 1;
  inset-block-start: 7px;
  inset-inline-end: var(--market-inline-margin);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--market-muted);
  cursor: pointer;
}

.market-strip-toggle:hover { background: var(--market-panel); }

.market-strip-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.market-strip-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.market-strip-curtain {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .25s ease;
}

.market-strip-curtain-body {
  min-height: var(--market-preview-height);
  overflow: hidden;
}

.market-strip.is-expanded .market-strip-curtain {
  grid-template-rows: 1fr;
}

.market-strip:not(.is-expanded) .market-strip-curtain-body {
  -webkit-mask-image: linear-gradient(#000 calc(100% - 13px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 13px), transparent);
  cursor: pointer;
}

.market-strip-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 16px;
  width: min(calc(100% - 40px), 1800px);
  padding: 7px 0 8px;
  margin: 0 auto;
}

.market-region-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(4px, 1.1vw, 16px);
}

.market-region-option {
  min-height: 44px;
  padding: 0 clamp(12px, 1.45vw, 22px);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--market-muted);
  font: inherit;
  font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
}

.market-region-option:hover {
  background: var(--market-panel);
  color: var(--market-copy);
}

.market-region-option[aria-pressed="true"] {
  border-color: var(--market-border);
  background: var(--market-panel);
  color: var(--market-copy);
}

.market-strip :is(button, [data-market-viewport]):focus-visible {
  outline: 2px solid #536471;
  outline-offset: -2px;
}

.market-strip-viewport {
  grid-column: 1 / -1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}

.market-strip-viewport::-webkit-scrollbar {
  display: none;
}

.market-strip-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max(180px, calc((100% - 4 * var(--market-gap)) / 5));
  gap: var(--market-gap);
}

.market-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: var(--market-card-height);
  padding: 9px clamp(10px, 1.1vw, 16px);
  border: 1px solid var(--market-border);
  border-radius: 12px;
  background: var(--market-panel);
  box-shadow: inset 0 1px rgba(255, 255, 255, .52);
  scroll-snap-align: start;
}

.market-card-title {
  display: block;
  margin-bottom: 4px;
  color: var(--market-copy);
  font-size: clamp(14px, 1.2vw, 17px);
  font-weight: 400;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.market-card-change {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--market-muted);
  font-size: clamp(16px, 1.35vw, 20px);
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  line-height: 1.12;
}

.market-card-change.is-positive {
  color: var(--market-up);
}

.market-card-change.is-negative {
  color: var(--market-down);
}

.market-card-index-level {
  color: var(--market-copy);
  font-size: 12px;
  white-space: nowrap;
}

.market-card-direction {
  display: inline-grid;
  place-items: center;
  width: 1.25em;
  height: 1.25em;
  border-radius: 50%;
  background: var(--market-up);
  color: #fff;
  font-size: clamp(7.6px, 0.68vw, 10.4px);
  line-height: 1;
}

.market-card-change.is-negative .market-card-direction {
  background: var(--market-down);
}

.market-card-history {
  margin-top: auto;
  padding-top: 5px;
}

.market-card-sparkline,
.market-card-history-status {
  height: var(--market-history-height);
  color: var(--market-muted);
}

.market-card-history-status {
  display: flex;
  align-items: center;
  font-size: 12px;
  line-height: 1.3;
}

.market-card-sparkline {
  display: block;
  width: 50%;
}

.market-card-sparkline.is-positive {
  color: var(--market-up);
}

.market-card-sparkline.is-negative {
  color: var(--market-down);
}

.market-card-sparkline-fill {
  fill: currentColor;
  fill-opacity: 0.13;
}

.market-card-sparkline-reference {
  stroke: var(--market-muted);
  stroke-opacity: 0.42;
  stroke-width: 1;
  stroke-dasharray: 1 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.market-card-sparkline-line,
.market-card-sparkline-end {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.market-card-sparkline-end {
  stroke-width: 3;
}

.market-card-loading {
  background:
    linear-gradient(var(--market-border) 0 0) 12px 14px / 74px 14px no-repeat,
    linear-gradient(var(--market-border) 0 0) 12px 37px / 58px 10px no-repeat,
    linear-gradient(var(--market-border) 0 0) 12px 58px / 68px 17px no-repeat,
    var(--market-panel);
  animation: market-loading 1.35s ease-in-out infinite alternate;
}

.market-strip-controls {
  display: flex;
  gap: 6px;
  margin-inline-end: 50px;
}

.market-strip-controls button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--market-border);
  border-radius: 50%;
  background: transparent;
  color: var(--market-muted);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.market-strip-controls button:hover {
  border-color: var(--market-muted);
  background: var(--market-panel);
  color: var(--market-copy);
}

.market-strip-track:has(> .market-strip-empty) {
  grid-auto-columns: 1fr;
}

.market-strip-empty {
  display: grid;
  align-items: center;
  min-height: var(--market-card-height);
  padding: 0 16px;
  color: var(--market-muted);
  font-size: 14px;
}

.market-strip-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes market-loading {
  to { opacity: 0.65; }
}

@media (max-width: 640px) {
  .market-strip {
    --market-card-height: 92px;
    --market-preview-height: 79px;
    --market-inline-margin: 12px;
  }

  .market-strip-inner {
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 24px);
  }

  .market-region-options { margin-inline-end: 44px; }

  .market-strip-track {
    grid-auto-columns: 158px;
  }

  .market-strip-controls {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .market-card-loading {
    animation: none;
  }

  .market-strip-curtain { transition: none; }
}

/* ==========================================================================
   Quote line + frosted curtain, shared by the public site and both portals.
   The line keeps a fixed height; the curtain floats over the page, so
   expanding it never changes the page layout.
   ========================================================================== */
html body .market-strip[data-market-strip] {
  --quote-height: 36px;
  --quote-up: #17834b;
  --quote-down: #c63636;
  --quote-font: var(--font, "Inter", "Segoe UI", "Juno Sans", Arial, sans-serif);
  position: relative;
  z-index: 40;
  height: var(--quote-height);
  border: 0;
  background: var(--portal-bg, #fff);
  color: #171717;
  font-family: var(--quote-font);
  isolation: isolate;
}

html body .market-strip[data-market-strip]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--portal-bg, #fff);
  border-bottom: 1px solid var(--portal-line, var(--line, #e3e3e3));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}

/* Scrolling quote line. */
html body .market-strip[data-market-strip] .market-led {
  position: absolute;
  inset: 0 48px 0 22px;
  z-index: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 32px, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 32px, #000 calc(100% - 32px), transparent);
}

.market-led-track {
  display: flex;
  width: max-content;
  animation: market-led-scroll var(--led-duration, 40s) linear infinite;
  will-change: transform;
}

.market-led-track.is-static {
  animation: none;
  padding-inline-start: 8px;
}

@keyframes market-led-scroll {
  to { transform: translateX(-50%); }
}

.market-led-group { display: flex; flex: 0 0 auto; }

html body .market-strip[data-market-strip] .market-led-item {
  display: inline-flex;
  align-items: baseline;
  gap: .5em;
  padding-inline: 1em;
  font-family: var(--quote-font);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

html body .market-strip[data-market-strip] .market-led-item:not(.is-message)::after {
  content: "";
  align-self: center;
  width: 1px;
  height: 12px;
  margin-inline-start: 1em;
  background: #e3e3e3;
}

html body .market-strip[data-market-strip] .market-led-symbol { color: #171717; font-weight: 600; letter-spacing: .02em; }
html body .market-strip[data-market-strip] .market-led-price { color: #525252; }
html body .market-strip[data-market-strip] .market-led-percent { color: #737373; }
html body .market-strip[data-market-strip] .market-led-item.is-positive .market-led-percent { color: var(--quote-up); }
html body .market-strip[data-market-strip] .market-led-item.is-negative .market-led-percent { color: var(--quote-down); }

html body .market-strip[data-market-strip] .market-led-item.is-message .market-led-symbol {
  color: #8a8a8a;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  animation: market-led-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes market-led-pulse {
  from { opacity: .45; }
  to { opacity: 1; }
}

html body .market-strip[data-market-strip] .market-strip-toggle {
  inset-block-start: 2px;
  inset-inline-end: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: #737373;
}

html body .market-strip[data-market-strip] .market-strip-toggle:hover { background: #f4f4f4; color: #171717; }

/* Frosted curtain. */
html body .market-strip[data-market-strip] .market-strip-curtain {
  --market-copy: #171717;
  --market-muted: #737373;
  --market-border: #e3e3e3;
  --market-panel: rgba(255, 255, 255, .72);
  --market-up: #17834b;
  --market-down: #c63636;
  position: absolute;
  inset-inline: 0;
  top: 100%;
  z-index: 3;
  display: block;
  color: #171717;
  background: rgba(250, 250, 250, .8);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid #e3e3e3;
  box-shadow: 0 18px 36px -18px rgba(23, 23, 23, .22);
  visibility: hidden;
  opacity: 0;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .3s cubic-bezier(.4, 0, .2, 1), opacity .2s ease, visibility 0s linear .3s;
}

html body .market-strip[data-market-strip].is-expanded .market-strip-curtain {
  visibility: visible;
  opacity: 1;
  clip-path: inset(0 -60px -80px -60px);
  transition: clip-path .36s cubic-bezier(.2, .8, .2, 1), opacity .18s ease, visibility 0s;
}

html body .market-strip[data-market-strip] .market-strip-curtain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 40%);
}

html body .market-strip[data-market-strip] .market-strip-curtain-body,
html body .market-strip[data-market-strip]:not(.is-expanded) .market-strip-curtain-body {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
  cursor: auto;
}

html body .market-strip[data-market-strip] .market-strip-inner {
  width: auto;
  max-width: 1800px;
  margin: 0 auto;
  padding: 14px 32px 18px;
}

html body .market-strip[data-market-strip] .market-card {
  border-color: #e3e3e3;
  border-radius: 6px;
  background: rgba(255, 255, 255, .85);
  box-shadow: none;
}

html body .market-strip[data-market-strip] .market-card-title { color: #171717; font-size: 13px; font-weight: 500; }
html body .market-strip[data-market-strip] .market-card-change { font-size: 15px; font-weight: 600; }
html body .market-strip[data-market-strip] .market-card-index-level { color: #525252; }
html body .market-strip[data-market-strip] .market-card-direction { color: #fff; }
html body .market-strip[data-market-strip] .market-card-sparkline-fill { fill-opacity: .08; }

html body .market-strip[data-market-strip] .market-region-option {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #525252;
  font-size: 12px;
}

html body .market-strip[data-market-strip] .market-region-option:hover { background: #f4f4f4; color: #171717; }

html body .market-strip[data-market-strip] .market-region-option[aria-pressed="true"] {
  border-color: #9ca3af;
  background: #fff;
  color: #171717;
  font-weight: 700;
}

html body .market-strip[data-market-strip] .market-strip-controls { margin-inline-end: 0; }

html body .market-strip[data-market-strip] .market-strip-controls button {
  width: 30px;
  height: 30px;
  border-color: #d4d4d4;
  border-radius: 4px;
  color: #525252;
  font-size: 18px;
}

html body .market-strip[data-market-strip] .market-strip-controls button:hover { border-color: #a3a3a3; background: #fff; color: #171717; }

html body .market-strip[data-market-strip] :is(a, button, [data-market-viewport]):focus-visible {
  outline: 2px solid #525252;
  outline-offset: -2px;
}

/* Staff and client workspaces: the line sits under the top bar and never scrolls with the page. */
.internal-main > .market-strip[data-market-strip] { flex: 0 0 auto; }

@media (max-width: 640px) {
  html body .market-strip[data-market-strip] .market-led { inset-inline: 8px 44px; }
  html body .market-strip[data-market-strip] .market-strip-inner { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .market-led-track,
  html body .market-strip[data-market-strip] .market-led-item.is-message .market-led-symbol { animation: none; }
  html body .market-strip[data-market-strip] .market-strip-curtain,
  html body .market-strip[data-market-strip].is-expanded .market-strip-curtain { transition: none; }
}
