/* =====================================================================
   HY-D · Instrument + Midnight details
   Base: HY-C (blueprint grid, framed modules, dimension line).
   Taken from HY-A, as chosen by HanYi:
     1. the segmented gradient ring and its slow motion
     2. the ASK timeline line colour (violet to cyan) and white glowing dots
     3. the fixed top navigation that jumps to each section
   New: S5 and S6 become one pinned section. The ring appears once; the corners change
   from the IP (what it is) to the value it creates (what it yields) as the visitor scrolls.
   ===================================================================== */
.hy-d {
  --violet: #9e3db2;
  --ice: #bfe9ff;
  --a-cyan: #6fd3ff;
}
html.hy-d { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html.hy-d { scroll-behavior: auto; } }

/* ---------- 3. navigation (from A), tuned to C's hairlines ---------- */
.hy-d .hy-nav.is-solid { background: rgba(6, 9, 28, 0.78); border-bottom-color: var(--hair-strong); }
.hy-d .hy-nav-links a { position: relative; }
.hy-d .hy-nav-links a.is-current { border-color: var(--hair-strong); }
.hy-d .hy-nav-links a.is-current::before {
  content: ""; position: absolute; left: 8px; top: 50%; width: 4px; height: 4px; margin-top: -2px; background: var(--signal); box-shadow: 0 0 8px var(--signal);
}
.hy-d .hy-nav-cta:hover { color: #0b1030; }

/* everything clears the fixed nav */
.hy-d .section, .hy-d .s2.section { padding-top: max(104px, calc(7 * var(--u))); }
.hy-d .s1-text { top: max(calc(6.5 * var(--u)), 84px); }
.hy-d .s4-head { top: max(calc(6.5 * var(--u) + 30px), 124px); }
.hy-d .s1-stage::before, .hy-d .s4-stage::before { top: max(calc(3 * var(--u)), 72px); }
.hy-d [id] { scroll-margin-top: 0; }

/* ---------- 2. timeline line and dots (from A) ---------- */
.hy-d .tl-dot { border-radius: 50%; transform: none; background: #0b1030; border-color: rgba(229, 231, 235, 0.6); }
.hy-d .tl-ph.is-on .tl-dot { background: #fff; border-color: #fff; box-shadow: 0 0 18px rgba(111, 211, 255, 0.6); }
.hy-d .tl-seg { background: rgba(190, 215, 255, 0.22); }
.hy-d .tl-seg::after { background: linear-gradient(90deg, var(--violet), var(--a-cyan)); box-shadow: none; }

/* ---------- 1. the ring (from A), inside C's instrument dial ---------- */
.hy-d .hub-ring { border: 0; box-shadow: none; background: radial-gradient(circle, rgba(25, 81, 162, 0.35) 0%, rgba(11, 16, 48, 0) 66%); }
.hy-d .hub-ring::before, .hy-d .hub-ring::after { content: none; }
.hy-d .hub-ring > span { position: absolute; inset: 0; border-radius: 50%; display: block; }
.hy-d .hx-dial {
  inset: -14% !important;
  background: repeating-conic-gradient(from 0deg, rgba(190, 215, 255, 0.45) 0deg 0.6deg, transparent 0.6deg 7.5deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
}
.hy-d .hx-rot { inset: -2% !important; transform: rotate(calc(var(--rot, 0) * 1deg)); transition: transform 0.9s cubic-bezier(0.25, 0.1, 0.25, 1); }
.hy-d .hx-arc {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 210deg, #1951a2, #3a6cf0, #6fd3ff, #d8f1ff, #c9b6e8, #9e3db2, #3a6cf0, #1951a2);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9%), #000 calc(100% - 8.6%), #000 100%),
                repeating-conic-gradient(from 0deg, #000 0deg 28deg, transparent 28deg 30deg);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(farthest-side, transparent calc(100% - 9%), #000 calc(100% - 8.6%), #000 100%) intersect,
                repeating-conic-gradient(from 0deg, #000 0deg 28deg, transparent 28deg 30deg);
  animation: hy-d-spin 60s linear infinite;
}
@keyframes hy-d-spin { to { transform: rotate(360deg); } }
.hy-d .hx-core { position: relative !important; inset: auto !important; display: grid !important; place-items: center; z-index: 1; line-height: 1; }

/* ---------- merged S5 / S6: one pinned section, two states ---------- */
.hy-d .hx-track { position: relative; height: 230vh; }
.hy-d .hx-anchor { position: absolute; left: 0; top: 58%; width: 1px; height: 1px; }
.hy-d .hx-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; align-items: center; overflow: hidden; }
.hy-d .hx-wrap { padding-top: 72px; }
.hy-d .hx-heads { display: grid; }
.hy-d .hx-state { grid-area: 1 / 1; transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.hy-d .hx-grp { position: absolute; inset: 0; transition: opacity 0.6s var(--ease); }
.hy-d .hx-val, .hy-d .hx-grp.hx-val { opacity: 0; pointer-events: none; }
.hy-d .hx-state.hx-val { transform: translateY(8px); }
.hy-d .hx-track.is-val .hx-ip { opacity: 0; pointer-events: none; }
.hy-d .hx-track.is-val .hx-state.hx-ip { transform: translateY(-8px); }
.hy-d .hx-track.is-val .hx-val { opacity: 1; pointer-events: auto; }
.hy-d .hx-track.is-val .hx-state.hx-val { transform: none; }
.hy-d .hx-val-head { display: none; }
.hy-d .hx-heads .hub-head { margin: 0; }
.hy-d .hx-grp.hx-val .hub-item { font-size: calc(2.1 * var(--u)); }
.hy-d .hx-grp.hx-val .hub-item.tl, .hy-d .hx-grp.hx-val .hub-item.tr { top: 6%; }
.hy-d .hx-grp.hx-val .hub-item.bl, .hy-d .hx-grp.hx-val .hub-item.br { bottom: 6%; }
.hy-d .hx-track .hub { margin-top: max(20px, calc(3 * var(--u))); }

/* two-state indicator: IP Platform ── Value, sitting at the right end of the section header bar */
.hy-d .hx-wrap { position: relative; }
.hy-d .hx-state .hy-tag::after { content: none; }
.hy-d .hx-steps {
  position: absolute; top: 72px; right: max(20px, calc(7 * var(--u))); height: 34px;
  display: flex; align-items: center; gap: 14px;
  font-weight: 600; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: rgba(255, 255, 255, 0.4);
}
.hy-d .hx-steps .bar { position: relative; width: 120px; height: 1px; background: var(--hair-strong); }
.hy-d .hx-steps .bar i { position: absolute; left: 0; top: 0; height: 1px; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, var(--violet), var(--a-cyan)); }
.hy-d .hx-steps span:first-child { color: #fff; }
.hy-d .hx-track.is-val .hx-steps span:first-child { color: rgba(255, 255, 255, 0.4); }
.hy-d .hx-track.is-val .hx-steps span:last-child { color: #fff; }

/* phones and portrait screens */
@media (max-width: 767px), (max-aspect-ratio: 1/1) {
  .hy-d .s1-stage, .hy-d .s4-stage, .hy-d .s8-stage, .hy-d .s7-stage { padding-top: 84px; }
  .hy-d .s1-text { top: auto; }
  .hy-d .s4-head { top: auto; margin-top: 36px; }
  .hy-d .hx-track { height: 240vh; }
  .hy-d .hx-pin { align-items: flex-start; }
  .hy-d .hx-wrap { padding-top: 76px; }
  .hy-d .hx-grp { position: static; grid-area: 2 / 1; display: grid; gap: 18px; align-content: start; }
  .hy-d .hx-track .hub { grid-template-rows: auto auto; }
  .hy-d .hub-ring { grid-area: 1 / 1; width: min(40vw, 200px); margin-bottom: 4px; }
  .hy-d .hx-grp.hx-val .hub-item { font-size: clamp(18px, 4.8vw, 24px); }
  .hy-d .hx-steps { top: 76px; gap: 8px; letter-spacing: 0.14em; font-size: 10px; }
  .hy-d .hx-steps .bar { width: 36px; }
  .hy-d .tl-dot { transform: translateX(-50%); }
  .hy-d .tl-seg::after { background: linear-gradient(180deg, var(--violet), var(--a-cyan)); }
}

/* reduced motion: no pinning; both views shown one after the other under the single ring */
@media (prefers-reduced-motion: reduce) {
  .hy-d .hx-arc { animation: none; }
  .hy-d .hx-rot { transition: none; }
  .hy-d .hx-track { height: auto; padding-block: 104px 64px; }
  .hy-d .hx-pin { position: static; height: auto; display: block; }
  .hy-d .hx-state.hx-val { display: none; }
  .hy-d .hx-grp, .hy-d .hx-grp.hx-val { position: static; grid-area: auto; opacity: 1; pointer-events: auto; display: grid; gap: 18px; margin-top: 28px; }
  .hy-d .hx-track .hub-ring { grid-area: auto; }
  .hy-d .hx-track .hub { aspect-ratio: auto; display: grid; }
  .hy-d .hub-lines { display: none; }
  .hy-d .hub-ring { position: relative; left: auto; top: auto; transform: none !important; width: min(40vw, 200px); justify-self: start; }
  .hy-d .hub-item, .hy-d .hx-grp.hx-val .hub-item { position: static; white-space: normal; }
  .hy-d .hx-val-head { display: block; margin: 28px 0 0; font-weight: 600; font-size: max(24px, calc(2.6 * var(--u))); }
  .hy-d .hx-steps { display: none; }
}
