/* ============================================================
   3D Build Visualizer — Unified Trades
   ============================================================ */

.viz-section {
  background: var(--color-ink, #171512);
  color: #f2efe8;
  overflow: hidden;
}
.viz-section .section-heading {
  color: #faf8f4;
}
.viz-section .eyebrow {
  color: var(--color-gold-on-ink, #dda23a);
}
.viz-section .eyebrow::before {
  background: var(--color-gold-on-ink, #dda23a);
}
.viz-section .section-intro {
  color: rgba(242, 239, 232, 0.68);
}

.viz-shell {
  margin-top: var(--space-10, 2.5rem);
  border: 1px solid rgba(221, 162, 58, 0.22);
  border-radius: var(--radius-xl, 20px);
  background: linear-gradient(180deg, #1d1b18 0%, #141210 100%);
  overflow: hidden;
}

/* ---------- toolbar ---------- */
.viz-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4, 1rem);
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4, 1rem) var(--space-5, 1.25rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.viz-tabs {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full, 999px);
}
.viz-tab {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full, 999px);
  background: transparent;
  color: rgba(242, 239, 232, 0.62);
  font: inherit;
  font-size: var(--text-sm, 0.9375rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, color 0.2s ease;
}
.viz-tab:hover {
  color: #f2efe8;
}
.viz-tab.is-active {
  background: var(--color-gold, #b5760e);
  color: #17130a;
}
.viz-tab:focus-visible {
  outline: 2px solid var(--color-gold-on-ink, #dda23a);
  outline-offset: 2px;
}

.viz-actions {
  display: inline-flex;
  gap: var(--space-2, 0.5rem);
}
.viz-btn {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm, 0.9375rem);
  font-weight: 600;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius-full, 999px);
  border: 1px solid rgba(221, 162, 58, 0.35);
  background: transparent;
  color: var(--color-gold-on-ink, #dda23a);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.viz-btn:hover {
  background: rgba(221, 162, 58, 0.14);
  border-color: rgba(221, 162, 58, 0.6);
}
.viz-btn:focus-visible {
  outline: 2px solid var(--color-gold-on-ink, #dda23a);
  outline-offset: 2px;
}
.viz-btn svg {
  flex: none;
}

/* ---------- stage ---------- */
.viz-stage {
  position: relative;
  height: clamp(400px, 56vh, 600px);
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(221, 162, 58, 0.11) 0%, rgba(0, 0, 0, 0) 62%),
    #131110;
  touch-action: pan-y;
}
.viz-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.viz-canvas:active {
  cursor: grabbing;
}

.viz-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 0.75rem;
  color: rgba(242, 239, 232, 0.55);
  font-size: var(--text-sm, 0.9375rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.viz-status[hidden] {
  display: none;
}
.viz-shell.is-ready .viz-status {
  opacity: 0;
}

.viz-hint {
  position: absolute;
  white-space: nowrap;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  font-size: var(--text-xs, 0.8125rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242, 239, 232, 0.42);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.viz-shell.is-touched .viz-hint {
  opacity: 0;
}

/* ---------- hotspots ---------- */
.viz-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.viz-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.viz-hotspot.is-on {
  opacity: 1;
}
.viz-hotspot::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--color-gold-on-ink, #dda23a);
  box-shadow: 0 0 0 4px rgba(221, 162, 58, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.viz-hotspot::after {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(221, 162, 58, 0.65);
  animation: viz-ping 2.6s ease-out infinite;
}
.viz-hotspot:hover::before,
.viz-hotspot.is-active::before {
  transform: scale(1.3);
  box-shadow: 0 0 0 7px rgba(221, 162, 58, 0.28);
}
.viz-hotspot:focus-visible {
  outline: 2px solid var(--color-gold-on-ink, #dda23a);
  outline-offset: 4px;
  border-radius: 50%;
}
.viz-hotspot.is-sub::before {
  background: #9fb4c2;
  box-shadow: 0 0 0 4px rgba(159, 180, 194, 0.2);
}
.viz-hotspot.is-sub::after {
  border-color: rgba(159, 180, 194, 0.55);
}
@keyframes viz-ping {
  0% { transform: scale(0.65); opacity: 0.9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .viz-hotspot::after { animation: none; }
}

/* ---------- info card ---------- */
.viz-card {
  position: absolute;
  left: var(--space-5, 1.25rem);
  bottom: var(--space-5, 1.25rem);
  width: min(340px, calc(100% - 2.5rem));
  padding: 1.1rem 1.25rem 1.2rem;
  background: rgba(18, 16, 14, 0.93);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(221, 162, 58, 0.28);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}
.viz-card.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.viz-card h4 {
  font-size: var(--text-lg, 1.125rem);
  color: #faf8f4;
  margin: 0.3rem 0 0.4rem;
  line-height: 1.25;
}
.viz-card p {
  font-size: var(--text-sm, 0.9375rem);
  line-height: 1.6;
  color: rgba(242, 239, 232, 0.72);
  margin: 0;
}
.viz-card-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-full, 999px);
  background: rgba(221, 162, 58, 0.16);
  color: var(--color-gold-on-ink, #dda23a);
  border: 1px solid rgba(221, 162, 58, 0.32);
}
.viz-card-tag.is-sub {
  background: rgba(159, 180, 194, 0.14);
  color: #b7cad6;
  border-color: rgba(159, 180, 194, 0.32);
}
.viz-card-close {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  appearance: none;
  border: 0;
  background: none;
  color: rgba(242, 239, 232, 0.5);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.35rem;
  border-radius: 50%;
}
.viz-card-close:hover {
  color: #f2efe8;
}

/* ---------- stage stepper ---------- */
.viz-steps {
  padding: var(--space-5, 1.25rem);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.viz-stage-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.viz-stage-num {
  font-family: var(--font-display, inherit);
  font-size: var(--text-sm, 0.9375rem);
  font-weight: 800;
  color: var(--color-gold-on-ink, #dda23a);
  letter-spacing: 0.08em;
}
.viz-stage-name {
  font-size: var(--text-lg, 1.125rem);
  font-weight: 700;
  color: #faf8f4;
}
.viz-stage-note {
  font-size: var(--text-sm, 0.9375rem);
  color: rgba(242, 239, 232, 0.6);
}

.viz-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.viz-dot {
  appearance: none;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
}
.viz-dot-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  transition: background 0.3s ease;
}
.viz-dot.is-done .viz-dot-bar {
  background: var(--color-gold, #b5760e);
}
.viz-dot.is-current .viz-dot-bar {
  background: var(--color-gold-on-ink, #dda23a);
}
.viz-dot.is-sub.is-done .viz-dot-bar,
.viz-dot.is-sub.is-current .viz-dot-bar {
  background: #9fb4c2;
}
.viz-dot-text {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(242, 239, 232, 0.42);
  transition: color 0.3s ease;
}
.viz-dot.is-current .viz-dot-text,
.viz-dot:hover .viz-dot-text {
  color: #f2efe8;
}
.viz-dot:focus-visible {
  outline: 2px solid var(--color-gold-on-ink, #dda23a);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- legend ---------- */
.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5, 1.25rem);
  align-items: center;
  padding: var(--space-4, 1rem) var(--space-5, 1.25rem);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin: 0;
  font-size: var(--text-sm, 0.9375rem);
  color: rgba(242, 239, 232, 0.62);
}
.viz-legend span {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.viz-legend i {
  width: 10px;
  height: 10px;
  margin-top: 0.45em;
  border-radius: 50%;
  background: var(--color-gold-on-ink, #dda23a);
  flex: none;
}
.viz-legend i.sub {
  background: #9fb4c2;
}

.viz-fallback {
  display: none;
  padding: var(--space-8, 2rem) var(--space-5, 1.25rem);
  text-align: center;
  color: rgba(242, 239, 232, 0.6);
  font-size: var(--text-sm, 0.9375rem);
  line-height: 1.7;
}
.viz-shell.is-failed .viz-stage,
.viz-shell.is-failed .viz-steps,
.viz-shell.is-failed .viz-toolbar {
  display: none;
}
.viz-shell.is-failed .viz-fallback {
  display: block;
}

@media (max-width: 700px) {
  .viz-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .viz-tabs {
    justify-content: center;
  }
  .viz-tab {
    flex: 1;
    text-align: center;
  }
  .viz-actions {
    justify-content: center;
  }
  .viz-stage {
    height: clamp(320px, 46vh, 420px);
  }
  .viz-track {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 1rem;
  }
  .viz-dot-text {
    min-height: 2.3em;
  }
  .viz-card {
    left: 0.75rem;
    bottom: 0.75rem;
    width: calc(100% - 1.5rem);
    padding: 0.9rem 1rem 1rem;
  }
  .viz-card p {
    font-size: 0.875rem;
    line-height: 1.55;
  }
  .viz-card h4 {
    font-size: 1rem;
  }
  .viz-card-tag {
    font-size: 0.625rem;
    letter-spacing: 0.09em;
  }
  .viz-hint {
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    bottom: 0.7rem;
  }
  .viz-legend {
    gap: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* The 3D Build nav link adds one item; tighten the tablet band so the header CTA still fits. */
@media (max-width: 1140px) and (min-width: 901px) {
  .main-nav {
    gap: var(--space-4);
  }
  .main-nav a {
    font-size: 0.9375rem;
  }
}

/* Pre-existing narrow-desktop overflow (901-1000px): tighten so the CTA never clips. */
@media (max-width: 1000px) and (min-width: 901px) {
  .main-nav {
    gap: var(--space-3);
  }
  .main-nav a {
    font-size: 0.9063rem;
  }
}
