/* Home page visuals: company map + market chart (home-viz.js) */

/* ---------- Company map ---------- */
.cv { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 48px; align-items: center; margin-top: 36px; }
.cv-stage { position: relative; width: 100%; max-width: 560px; aspect-ratio: 1 / 1; margin: 0 auto; }
.cv-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cv-line { stroke: var(--line); stroke-width: 0.35; stroke-dasharray: 60; stroke-dashoffset: 60; transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1), stroke .3s ease, stroke-width .3s ease, opacity .3s ease; }
.cv-in .cv-line { stroke-dashoffset: 0; }
.cv-line.is-active { stroke: var(--bronze); stroke-width: 0.6; }
.cv-ring { position: absolute; inset: 11%; border: 1px dashed var(--line); border-radius: 50%; opacity: 0; transition: opacity 1s ease .3s; }
.cv-in .cv-ring { opacity: 1; animation: cvSpin 90s linear infinite; }
@keyframes cvSpin { to { transform: rotate(360deg); } }

.cv-hub { position: absolute; left: 50%; top: 50%; width: 36%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%) scale(.85); border-radius: 50%; background: var(--ink); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; opacity: 0; transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 0 10px rgba(0,0,0,.03); }
.cv-in .cv-hub { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cv-hub::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1px solid var(--bronze); opacity: 0; }
.cv-in .cv-hub::after { animation: cvPulse 3.2s ease-out 1s infinite; }
@keyframes cvPulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.35); opacity: 0; } }
.cv-hub-num { font-size: clamp(30px, 6vw, 46px); font-weight: 600; line-height: 1; color: var(--bronze); }
.cv-hub-label { font-size: clamp(8px, 2.1vw, 11px); letter-spacing: .05em; padding: 0 10%; text-transform: uppercase; margin-top: 6px; opacity: .8; }
.cv-hub-name { font-size: clamp(10px, 1.8vw, 13px); font-weight: 600; margin-top: 6px; }

.cv-node { position: absolute; width: 19%; aspect-ratio: 1 / 1; transform: translate(-50%, -50%) scale(.4); border-radius: 50%; background: #fff; border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 0; opacity: 0; transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.2,1), border-color .3s ease, box-shadow .3s ease; text-decoration: none; z-index: 1; }
.cv-in .cv-node { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cv-node img { width: 80%; height: 80%; object-fit: contain; display: block; }
.cv-node[data-cat="dev"] { border-color: color-mix(in srgb, var(--bronze) 45%, transparent); }
.cv-node[data-cat="adv"] { border-color: var(--ink); }
.cv-node[data-cat="tech"] { border-color: var(--sub); border-style: dashed; }
.cv-in .cv-node.is-active { transform: translate(-50%, -50%) scale(1.18); border-color: var(--bronze); box-shadow: 0 10px 28px rgba(0,0,0,.12); z-index: 2; transition-delay: 0ms !important; }
.cv-node:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; }
.cv-stage[data-filter="dev"] .cv-node:not([data-cat="dev"]),
.cv-stage[data-filter="adv"] .cv-node:not([data-cat="adv"]),
.cv-stage[data-filter="tech"] .cv-node:not([data-cat="tech"]) { opacity: .2; }

.cv-detail { min-height: 220px; }
.cv-detail.is-swap > * { animation: cvFade .45s ease both; }
.cv-detail.is-swap > *:nth-child(2) { animation-delay: .04s; }
.cv-detail.is-swap > *:nth-child(3) { animation-delay: .08s; }
.cv-detail.is-swap > *:nth-child(4) { animation-delay: .12s; }
@keyframes cvFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cv-detail-sector { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze); }
.cv-detail-name { font-size: clamp(24px, 3vw, 32px); line-height: 1.15; margin-top: 10px; color: var(--ink); }
.cv-detail-desc { color: var(--sub); margin-top: 12px; max-width: 440px; }
.cv-detail-link { display: inline-block; margin-top: 14px; }
.cv-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.cv-legend button { font: inherit; font-size: 12.5px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background .2s ease, border-color .2s ease; }
.cv-legend button:hover, .cv-legend button[aria-pressed="true"] { border-color: var(--bronze); background: var(--panel); }
.cv-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cv-legend [data-cat="dev"] i { background: var(--bronze); }
.cv-legend [data-cat="adv"] i { background: var(--ink); }
.cv-legend [data-cat="tech"] i { background: transparent; border: 1.5px dashed var(--sub); }
.cv-legend b { font-weight: 600; color: var(--sub); }
.cv-cta { margin-top: 28px; }
.cv-hint { font-size: 12.5px; color: var(--faint); margin-top: 12px; }

/* Without JS: simple wrap of logo chips */
.cv:not(.cv-ready) .cv-stage { aspect-ratio: auto; display: flex; flex-wrap: wrap; gap: 12px; }
.cv:not(.cv-ready) .cv-node { position: static; opacity: 1; transform: none; width: 96px; }
.cv:not(.cv-ready) .cv-hub, .cv:not(.cv-ready) .cv-ring, .cv:not(.cv-ready) .cv-lines { display: none; }

@media (max-width: 860px) {
  .cv { grid-template-columns: 1fr; gap: 28px; }
  .cv-stage { max-width: 440px; }
  .cv-detail { min-height: 0; text-align: center; }
  .cv-detail-desc { margin-left: auto; margin-right: auto; }
  .cv-legend { justify-content: center; }
  .cv-cta { text-align: center; }
  .cv-node { width: 21%; }
}

/* ---------- Market chart ---------- */
.mc { margin-top: 32px; align-items: start; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; }
.mc-tabs { display: flex; flex-direction: column; gap: 6px; }
.mc-tab { font: inherit; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; transition: border-color .2s ease, background .2s ease, transform .2s ease; color: var(--ink); }
.mc-tab:hover { border-color: var(--bronze); }
.mc-tab.is-active { border-color: var(--bronze); background: #fff; box-shadow: inset 3px 0 0 var(--bronze); }
.mc-tab:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
.mc-tab-label { font-size: 12px; color: var(--sub); }
.mc-tab-value { font-size: 16px; font-weight: 600; grid-row: 2; }
.mc-spark { grid-column: 2; grid-row: 1 / span 2; width: 72px; height: 24px; overflow: visible; }
.mc-spark path { fill: none; stroke: var(--faint); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.mc-tab.is-active .mc-spark path { stroke: var(--bronze); }

.mc-main { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 22px 22px 16px; min-width: 0; }
.mc-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze); }
.mc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.mc-head .mc-label { flex-basis: 100%; }
.mc-value { font-size: clamp(34px, 5vw, 48px); font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.mc-change { font-size: 13px; color: var(--sub); }
.mc-change.up::before { content: "\25B2  "; font-size: 10px; }
.mc-change.down::before { content: "\25BC  "; font-size: 10px; }
.mc-plot { position: relative; margin-top: 12px; }
.mc-plot svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; }
.mc-noplot svg { display: none; }
.mc-grid { stroke: var(--line); stroke-width: 1; }
.mc-zero { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.mc-axis { font-size: 11px; fill: var(--faint); font-family: inherit; }
.mc-line { fill: none; stroke: var(--bronze); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.mc-stop-a { stop-color: var(--bronze); stop-opacity: .22; }
.mc-stop-b { stop-color: var(--bronze); stop-opacity: 0; }
.mc-end { fill: var(--bronze); stroke: #fff; stroke-width: 2; }
.mc-guide, .mc-hover { opacity: 0; transition: opacity .15s ease; }
.mc-guide { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.mc-hover { fill: #fff; stroke: var(--ink); stroke-width: 2; }
svg.is-hover .mc-guide, svg.is-hover .mc-hover { opacity: 1; }
.mc-tip { position: absolute; transform: translate(12px, -120%); background: var(--ink); color: #fff; border-radius: 6px; padding: 6px 10px; font-size: 12px; line-height: 1.3; pointer-events: none; opacity: 0; transition: opacity .15s ease; white-space: nowrap; }
.mc-tip.flip { transform: translate(calc(-100% - 12px), -120%); }
.mc-tip.is-on { opacity: 1; }
.mc-tip strong { display: block; font-size: 14px; }
.mc-tip span { opacity: .75; }
.mc-foot { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.mc-foot a { color: var(--faint); text-decoration: underline; }
.mc-empty { grid-column: 1 / -1; font-size: 14px; color: var(--sub); padding: 18px; border: 1px solid var(--line); border-radius: 8px; }
.mc:not(.mc-ready):not(.mc-unavailable) .mc-main { min-height: 360px; }

@media (max-width: 860px) {
  .mc { grid-template-columns: 1fr; }
  .mc-tabs { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
  .mc-tabs::-webkit-scrollbar { display: none; }
  .mc-tab { flex: 0 0 auto; min-width: 150px; scroll-snap-align: start; }
  .mc-tab.is-active { box-shadow: inset 0 -3px 0 var(--bronze); }
  .mc-main { padding: 18px 14px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .cv *, .mc * { animation: none !important; transition: none !important; }
}
