/** @format */

/* ============================================================
   YUKHYO CELESTIAL — Wu Xing Trigram Diagram (jsmodules)
   2026-08-28 (owner ruling): the Ohaeng wheel is replaced by the
   TWO-PHASE trigram layout. Phase 1 = the 先天 Fuxi generation
   order as a numbered chain — the eight trigram pills stacked
   down the center, arrows flowing down to the taiji. Phase 2 =
   the trigram wheel — the same eight pills fly onto the Fuxi
   circle (opposites mirror, pairs sum to 9), each labeled with
   its Wu Xing phase, the generation chain drawn as arcs and the
   element families as dashed chords. Phase 1 animates into
   phase 2 on first scroll into view (wireWuXingPhases); the
   tabs flip back and forth manually.
   Pillar 1: @imported by main.css (main.css?v bump required).
   ============================================================ */

.wuxing-diagram-container {
  text-align: center;
}

.wuxing-subtitle {
  font-style: italic;
  color: var(--shadow-purple);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* --- the phase tabs --- */
.wuxing-phase-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.wuxing-phase-btn {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 0.85em;
  color: #c8d8c2;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.28);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.wuxing-phase-btn:hover {
  border-color: rgba(255, 215, 0, 0.55);
  color: #ffe97a;
}

.wuxing-phase-btn.active {
  background: rgba(255, 215, 0, 0.16);
  color: #ffe97a;
  border-color: rgba(255, 215, 0, 0.7);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25);
}

.wuxing-diagram {
  margin: 16px 0;
  display: flex;
  justify-content: center;
}

.wuxing-svg {
  width: 100%;
  /* 2026-09-08 (owner: "the items need to be larger, it is hard to read") */
  max-width: 460px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
}

/* --- the two phase nets crossfade --- */
.wuxing-phase1-net {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.wuxing-phase2-net {
  opacity: 0;
  transition: opacity 0.5s ease 0.6s;
}

.wuxing-diagram.phase2 .wuxing-phase1-net {
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wuxing-diagram.phase2 .wuxing-phase2-net {
  opacity: 1;
  transition: opacity 0.8s ease 0.75s;
}

/* phase 1 — the generation chain arrows */
.wuxing-list-arrow {
  stroke: #3f9e4d;
  stroke-width: 2.2;
  opacity: 0.85;
}

/* phase 2 — the wheel rings */
.wuxing-svg .wuxing-orbit {
  fill: none;
  stroke: rgba(255, 215, 0, 0.18);
  stroke-width: 1.2;
  stroke-dasharray: 4 6;
}

.wuxing-svg .wuxing-orbit-inner {
  fill: none;
  stroke: rgba(154, 123, 255, 0.16);
  stroke-width: 0.9;
  stroke-dasharray: 2 7;
}

/* phase 2 — the generation chain arcs (1→2→…→8) */
.wuxing-chain {
  stroke: #3f9e4d;
  stroke-width: 2.4;
  fill: none;
  opacity: 0.8;
}

/* phase 2 — the element family chords (乾兌 Metal · 震巽 Wood · 艮坤 Earth) */
.wuxing-chord {
  stroke-width: 1.6;
  stroke-dasharray: 4 5;
  opacity: 0.55;
  fill: none;
}

/* the taiji — waits at the bottom of the chain, then rises to the
   wheel's center (transform driven by the --t* custom props) */
.wuxing-taiji {
  transform: translate(var(--tx1), var(--ty1)) scale(var(--ts1));
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.5s cubic-bezier(0.34, 1.2, 0.4, 1);
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.35));
}

.wuxing-diagram.phase2 .wuxing-taiji {
  transform: translate(var(--tx2), var(--ty2)) scale(var(--ts2));
}

/* the eight trigram pills — phase positions live in the --x/--y
   custom props (set per item by the renderer; phase 1 = the stack,
   phase 2 = the wheel, scaled 0.72) */
.wuxing-trigram-item {
  transform: translate(var(--x1), var(--y1)) scale(1);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.5s cubic-bezier(0.45, 0, 0.25, 1);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.wuxing-diagram.phase2 .wuxing-trigram-item {
  transform: translate(var(--x2), var(--y2)) scale(var(--s2, 0.85));
}

.wuxing-item-dominant {
  filter: drop-shadow(0 0 7px rgba(255, 215, 0, 0.45));
}

.wuxing-num {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 14px;
  font-weight: 700;
}

.wuxing-svg .wuxing-hanja {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 18px;
  font-weight: 700;
}

.wuxing-svg .wuxing-hangul {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.wuxing-svg .wuxing-english {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 11px;
}

.wuxing-svg .wuxing-eltag {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 11px;
  font-weight: 700;
}

/* --- the legend --- */
.wuxing-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 14px 0;
}

.wuxing-legend-chip {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 0.82em;
  color: #c8d8c2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wuxing-legend-chip i {
  width: 16px;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
}

.wuxing-legend-chip.saeng i {
  border-top-color: #3f9e4d;
}

/* --- the celestial verdict --- */
.wuxing-verdict {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
}

.verdict-header {
  font-size: 0.9em;
  color: var(--shadow-purple);
  margin-bottom: 5px;
}

.verdict-main {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 1.5em;
  color: var(--imperial-gold);
  font-weight: bold;
  margin-bottom: 5px;
}

.verdict-subtext {
  font-style: italic;
  color: var(--shadow-purple);
  margin-bottom: 10px;
}

.verdict-analysis {
  font-size: 0.9em;
  color: #ccc;
  margin-bottom: 10px;
}

/* ============================================================
   2026-09-30 (owner ruling — "All three: Day Master meter + Opposing
   Forces + Remedies"): three panels that read the elementProfile and
   the Wu Xing strengths directly. Deterministic — no Math.random.
   ============================================================ */

.yukhyo-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.yukhyo-panel-header h4 {
  margin: 0;
}

/* --- Day Master meter --- */
.yukhyo-daymaster .dm-band {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.dm-label {
  font-family: 'Orbitron', monospace;
  font-size: 0.8em;
  color: var(--shadow-purple);
  letter-spacing: 1px;
}

.dm-value {
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-size: 1.2em;
  font-weight: 700;
  color: var(--imperial-gold);
}

.dm-strength {
  margin-left: auto;
  font-family: 'Orbitron', monospace;
  font-weight: 700;
}

.dm-meter {
  margin-top: 10px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.dm-meter-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.dm-meter-fill.wood, .dm-band.wood .dm-strength { background: #4CAF50; color: #4CAF50; }
.dm-meter-fill.fire, .dm-band.fire .dm-strength { background: #F44336; color: #F44336; }
.dm-meter-fill.earth, .dm-band.earth .dm-strength { background: #FF9800; color: #FF9800; }
.dm-meter-fill.metal, .dm-band.metal .dm-strength { background: #9E9E9E; color: #cfd6dd; }
.dm-meter-fill.water, .dm-band.water .dm-strength { background: #2196F3; color: #2196F3; }

/* --- Opposing Forces --- */
.forces-grid {
  display: grid;
  gap: 10px;
}

.force-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.force-role {
  width: 92px;
  flex-shrink: 0;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--shadow-purple);
}

.force-element {
  width: 52px;
  flex-shrink: 0;
  font-size: 0.9em;
  font-weight: 700;
}

.force-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.force-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.force-fill.wood { background: #4CAF50; }
.force-fill.fire { background: #F44336; }
.force-fill.earth { background: #FF9800; }
.force-fill.metal { background: #9E9E9E; }
.force-fill.water { background: #2196F3; }

.force-row.wood .force-element { color: #4CAF50; }
.force-row.fire .force-element { color: #F44336; }
.force-row.earth .force-element { color: #FF9800; }
.force-row.metal .force-element { color: #cfd6dd; }
.force-row.water .force-element { color: #2196F3; }

.force-pct {
  width: 44px;
  flex-shrink: 0;
  text-align: right;
  font-family: 'Orbitron', monospace;
  font-size: 0.85em;
}

/* --- Remedies --- */
.remedy-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.remedy-need {
  align-self: flex-start;
  padding: 4px 14px;
  border-radius: 999px;
  font-family: 'Noto Serif KR', 'Nanum Myeongjo', serif;
  font-weight: 700;
}

.remedy-action {
  font-size: 0.95em;
  line-height: 1.55;
  color: #ccc;
}

/* --- responsive --- */
@media (max-width: 768px) {
  .wuxing-svg {
    max-width: 360px;
  }
}

@media (max-width: 480px) {
  .wuxing-svg {
    max-width: 310px;
  }

  .wuxing-phase-btn {
    font-size: 0.78em;
    padding: 5px 10px;
  }
}
