/* Guides: the filled talent tree in a spec's opening card (assets/js/guide-trees.js). Trees, tiles, lines and the
   tooltip are the calculator's (talents.css, loaded with the widget); this file frames the widget, styles its build
   tabs (part of the widget, not a page strip) and sizes the trees: three side by side, one at a time on phones. */
.guide-trees { margin: 0 0 18px; }
.guide-trees-line { margin: 0 0 10px; }
.guide-spec-head .guide-calc-link { font-size: 0.85em; color: var(--nag-text-dim); }

.tree-widget {
  margin: 14px -8px 2px;
  border: 1px solid rgba(221, 163, 67, 0.28);
  border-radius: 10px;
  background: rgba(5, 6, 8, 0.7);
  overflow: hidden;
}
.tree-widget[hidden] { display: none; }

/* header: class icon, then the builds as segments of one control */
.tree-widget__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
}
.tree-widget__class { flex: none; width: 30px; height: 30px; border: 1px solid rgba(221, 163, 67, 0.55); border-radius: 50%; }
.tree-widget__builds { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; padding: 3px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); }
.tree-widget__build {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 3px 10px 3px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--nag-text-dim);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.tree-widget__build img { width: 22px; height: 22px; border-radius: 4px; opacity: 0.6; }
.tree-widget__split { color: var(--nag-text-faint); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tree-widget__build:hover { color: var(--nag-text); }
.tree-widget__build[aria-selected="true"] { border-color: rgba(221, 163, 67, 0.55); background: rgba(221, 163, 67, 0.14); color: var(--nag-text); }
.tree-widget__build[aria-selected="true"] img { opacity: 1; }
.tree-widget__build[aria-selected="true"] .tree-widget__split { color: var(--nag-gold-hover); }
.tree-widget__build:focus-visible { outline: 2px solid var(--nag-focus-ring, #dda343); outline-offset: 1px; }

/* the trees: space held from the start so the page does not jump when they draw */
.tree-widget__view { min-height: 384px; padding: 10px; }
.tree-widget__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tree-widget__trees { display: none; }
.tree-widget .talents-tree { margin: 0; }
.tree-widget .talents-tree__head { padding: 6px 8px; margin-bottom: 12px; }
.tree-widget .talents-tree__name { font-size: 0.9rem; font-weight: 700; }
.tree-widget .talents-grid { grid-template-columns: repeat(4, 36px); gap: 11px 13px; justify-content: center; padding: 0; }
.tree-widget .talents-tile { width: 36px; max-width: none; cursor: default; }
.tree-widget .talents-tile__badge { right: -8px; bottom: -8px; font-size: 0.66rem; padding: 0 3px; }
.tree-widget .talents-tile__initials { font-size: 0.65rem; }
.tree-widget .talents-line--v { width: 3px; }
.tree-widget .talents-line--h { height: 3px; }

/* phones: one tree at a time; the tree switch is a segmented row inside the widget */
@media (max-width: 760px) {
  .tree-widget { margin: 12px -6px 2px; }
  .tree-widget__bar { gap: 8px; padding: 8px; }
  .tree-widget__class { width: 26px; height: 26px; }
  .tree-widget__builds { flex: 1 1 0; }
  /* a build tab: its icon, the name, the split under it when the row is narrow */
  .tree-widget__build { flex: 1 1 0; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-items: center; padding: 4px 8px 4px 4px; text-align: left; line-height: 1.25; }
  .tree-widget__build img { grid-row: 1 / span 2; width: 20px; height: 20px; }
  .tree-widget__name { grid-column: 2; }
  .tree-widget__split { grid-column: 2; font-size: 0.8rem; }
  .tree-widget__view { min-height: 450px; padding: 8px; }
  .tree-widget__grid { grid-template-columns: minmax(0, 1fr); }
  .tree-widget .talents-tree { display: none; }
  .tree-widget .talents-tree.is-active { display: block; }
  .tree-widget .talents-tree .talents-tree__head { display: none; }
  .tree-widget .talents-tree { padding-top: 14px; }
  .tree-widget__trees.talents-tabs { margin: 0 0 8px; }
  .tree-widget .talents-grid { grid-template-columns: repeat(4, 44px); gap: 13px 18px; }
  .tree-widget .talents-tile { width: 44px; }
  .tree-widget .talents-tile__badge { font-size: 0.72rem; }
}
/* a narrow phone: the build row scrolls sideways, each label keeps one name line + its split (Mage Frost names are long) */
@media (max-width: 480px) {
  .tree-widget__builds { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tree-widget__build { flex: 1 0 auto; }
  .tree-widget__name { white-space: nowrap; }
}
@media (max-width: 380px) {
  .tree-widget .talents-grid { grid-template-columns: repeat(4, 42px); gap: 12px 14px; }
  .tree-widget .talents-tile { width: 42px; }
}

@media print {
  .tree-widget { display: none; }
}
