/**
 * Diablo IV Planner Tabs Stylesheet
 * Author: vlad1116
 * Website: https://arpg-life.ru
 * Version: 0.4.0
 *
 * Only the tab bar + sandbox toggle + notice strip. skill-tree.css and
 * paragon-board.css are loaded alongside this (see planner-tabs.php) and
 * own everything inside .d4pt-content. There is no class switcher here by
 * design — the class shown is fixed per embed (see planner-tabs.js).
 *
 * .d4pt-prose near the bottom styles the OTHER thing planner-tabs.js can
 * boot (layout==='section' — [d4_build id=X section="..."], see its own
 * docblock): one bare build widget/text field with no heading or card of
 * its own, meant to be placed by hand among other content in the normal
 * WordPress editor.
 */

.d4pt-shell {
  --d4pt-bg: #0b0b0e;
  --d4pt-line: #2f2e34;
  --d4pt-accent: #c69a45;
  --d4pt-gold: #e8b971;
  --d4pt-text: #ececf1;

  width: min(960px, calc(100vw - 32px));
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: var(--d4pt-bg);
  border: 1px solid #2c2b30;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .45);
}

.d4pt-shell * {
  box-sizing: border-box;
}

.d4pt-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--d4pt-line);
  background: linear-gradient(180deg, #17171b, #101014);
}

.d4pt-tabs {
  display: flex;
  gap: 2px;
  background: #0f0e0c;
  border: 1px solid var(--d4pt-line);
  border-radius: 3px;
  padding: 2px;
}

.d4pt-tab {
  border: none;
  background: transparent;
  color: #aaa8b1;
  padding: 7px 16px;
  border-radius: 2px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  transition: all .15s ease;
}

.d4pt-tab:hover {
  color: #fff;
}

.d4pt-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, #3a1b20, #231418);
  box-shadow: inset 0 -2px #b8323b;
}

/* Build variants (Starter/Leveling/Endgame-style progression stages of one
   character) — a second, independent row of tabs, siblings of .d4pt-tabs
   rather than nested inside it so the two tab loops in planner-tabs.js
   never pick up each other's buttons. Hidden whenever a build has 0-1
   variants (every build before this feature existed, and any build an
   admin never split into stages) — .d4pt-tabs sets its own `display`, and
   the UA [hidden] rule loses to any later same-specificity `display`
   declaration, so this needs an explicit override or the row would stay
   visible on every single-variant build. */

.d4pt-variants {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.d4pt-variants[hidden] {
  display: none;
}

.d4pt-variant {
  border: none;
  background: #14120f;
  color: #aaa8b1;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: all .15s ease;
}

.d4pt-variant:hover {
  color: #fff;
}

.d4pt-variant.is-active {
  color: #fff;
  background: linear-gradient(180deg, #2b1f13, #1a130a);
  box-shadow: 0 0 0 1px var(--d4pt-gold) inset;
}

/* Also reused bare by bootSingleSection() (section="paragon"'s fallback
   warning) — outside .d4pt-shell there, hence the fallback color values
   below (none of .d4pt-shell's custom properties are guaranteed defined). */
.d4pt-notice {
  padding: 8px 20px;
  background: #272013;
  color: #ddc8a2;
  border-bottom: 3px solid var(--d4pt-accent, #c69a45);
  font-size: 13px;
}

.d4pt-content {
  /* Each bootX() paints its own full-width header/canvas/footer here. */
}

/* Both sub-widgets normally center themselves with their own margin/shadow
   as standalone blocks — inside the shell that duplicates the outer frame. */
.d4pt-content .d4st-planner,
.d4pt-content .d4pb-planner {
  width: 100%;
  margin: 0;
  border: none;
  border-top: 1px solid var(--d4pt-line);
  box-shadow: none;
}

@media (max-width: 620px) {
  .d4pt-topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---- Single-section embed ([d4_build id=X section="..."]) ---- */

/* Итог (see renderProseParagraphs() in planner-tabs.js) — plain flowing
   text; empty in the DOM entirely whenever the underlying field is empty. */
.d4pt-prose {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 14px;
}

.d4pt-prose:empty {
  display: none;
  margin-bottom: 0;
}

.d4pt-prose p {
  margin: 0 0 12px;
}

.d4pt-prose p:last-child {
  margin-bottom: 0;
}

/* Frame around a read-only skill tree / paragon board (build-steps.js,
   fullscreen-view.js): a bar on top with the step control in the middle and the
   «На весь экран» button at the end, the widget below. Also used by the bare
   section="talents|paragon" embeds, so not scoped to the tabs shell. */
.d4fs-frame {
  container: d4fs / inline-size;
}

.d4fs-bar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(36px, 1fr) minmax(0, auto) minmax(36px, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.d4fs-bar__mid {
  min-width: 0;
  max-width: 100%;
}

.d4fs-bar__side--end {
  display: flex;
  justify-content: flex-end;
}

/* Step control: «‹ [ Название шага ▾ ] ›» */
.d4-stepper {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.d4-stepper__mid {
  position: relative;
  display: flex;
  min-width: 0;
}

.d4-stepper__nav,
.d4-stepper__current {
  margin: 0;
  border: 1px solid #4a3b29;
  border-radius: 3px;
  background: #14120f;
  color: #d1bfa0;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
}

.d4-stepper__nav {
  flex: 0 0 auto;
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 20px;
}

.d4-stepper__nav:disabled {
  opacity: .35;
  cursor: default;
}

.d4-stepper__current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 6px 12px;
  color: #f7e0b5;
  border-color: #c49944;
  background: linear-gradient(180deg, #2b1f13, #1a130a);
  text-align: left;
}

.d4-stepper__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d4-stepper__caret {
  flex: 0 0 auto;
  font-size: 12px;
  transition: transform .15s ease;
}

.d4-stepper.is-open .d4-stepper__caret {
  transform: rotate(180deg);
}

.d4-stepper__nav:hover:not(:disabled),
.d4-stepper__current:hover {
  color: #fff;
  border-color: #c49944;
}

.d4-stepper__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  box-sizing: border-box;
  width: max-content;
  min-width: 100%;
  max-width: min(380px, 92vw);
  max-height: min(360px, 55vh);
  overflow-y: auto;
  padding: 4px;
  background: linear-gradient(180deg, #1c1a16, #121110);
  border: 1px solid #5f584b;
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
}

.d4-stepper__list[hidden] {
  display: none;
}

.d4-stepper__option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #ececf1;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.d4-stepper__option:hover,
.d4-stepper__option:focus-visible {
  background: rgba(196, 153, 68, .16);
  border-color: rgba(196, 153, 68, .4);
  outline: none;
}

.d4-stepper__option.is-current {
  border-color: #e8b971;
  background: rgba(232, 185, 113, .12);
  color: #fff;
}

.d4-stepper__option.is-current .d4-stepper__opt-name::before {
  content: '✓ ';
  color: #e8b971;
}

.d4-stepper__sep,
.d4-stepper__opt-points {
  color: #8f8b97;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.d4-stepper__option.is-current .d4-stepper__sep,
.d4-stepper__option.is-current .d4-stepper__opt-points {
  color: #e8b971;
}

.d4-stepper__nav:focus-visible,
.d4-stepper__current:focus-visible,
.d4fs-open:focus-visible,
.d4fs-close:focus-visible {
  outline: 2px solid #e8b971;
  outline-offset: 1px;
}

/* «На весь экран» */
.d4fs-open,
.d4fs-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid #4a3b29;
  border-radius: 3px;
  background: #14120f;
  color: #d1bfa0;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}

.d4fs-open:hover,
.d4fs-close:hover {
  color: #fff;
  border-color: #c49944;
}

.d4fs-open__icon {
  font-size: 16px;
  line-height: 1;
}

/* Narrow block: the step list becomes a sheet as wide as the block, the
   «На весь экран» button keeps only its icon. */
@container d4fs (max-width: 520px) {
  .d4fs-open {
    width: 36px;
    padding: 0;
  }
  .d4fs-open__text {
    display: none;
  }
  .d4-stepper__mid {
    position: static;
  }
  .d4-stepper__list {
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    transform: none;
    width: auto;
    max-width: none;
  }
}

/* The full-screen view: the frame lives in a fixed overlay (fullscreen-view.js) */
html.d4fs-lock,
html.d4fs-lock body {
  overflow: hidden;
}

.d4fs-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  background: #07070a;
  overscroll-behavior: contain;
}

.d4fs-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 40;
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 18px;
}

.d4fs-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 8px;
}

.d4fs-overlay .d4fs-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.d4fs-overlay .d4fs-bar {
  flex: 0 0 auto;
  min-height: 40px;
  margin: 0 0 8px;
  padding: 0 40px;
}

.d4fs-overlay .d4fs-open {
  display: none;
}

.d4fs-overlay .d4fs-bar__mid {
  display: flex;
  justify-content: center;
}

/* Narrow screen: the ✕ takes the right edge, the step control gets the rest. */
@container d4fs (max-width: 520px) {
  .d4fs-overlay .d4fs-bar {
    grid-template-columns: 0 minmax(0, 1fr) 0;
    padding: 0 48px 0 0;
  }
}

.d4fs-overlay .d4fs-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.d4fs-overlay .d4st-planner,
.d4fs-overlay .d4pb-planner {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  border: 0;
  box-shadow: none;
}

.d4fs-overlay .d4st-header,
.d4fs-overlay .d4pb-header {
  flex: 0 0 auto;
  max-height: 40%;
  overflow-y: auto;
  padding: 8px 12px;
}

.d4fs-overlay .d4st-header__top,
.d4fs-overlay .d4pb-header__top,
.d4fs-overlay .d4st-order-panel,
.d4fs-overlay .d4st-footer,
.d4fs-overlay .d4st-btn--order-toggle,
.d4fs-overlay .d4pb-help {
  display: none;
}

.d4fs-overlay .d4st-toolbar {
  padding-top: 0;
  border-top: 0;
}

.d4fs-overlay .d4st-body {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.d4fs-overlay .d4st-canvas-viewport,
.d4fs-overlay .d4pb-canvas-viewport {
  flex: 1 1 0;
  width: auto;
  height: auto;
  min-height: 0;
}

.d4fs-overlay .d4pb-footer {
  flex: 0 0 auto;
  max-height: 22%;
  overflow-y: auto;
}

/* While an embed's data files load (includes/client-data.php) — keeps the
   space so the article doesn't jump when the build appears. */
.d4-skill-blocks-planner-root.is-loading {
  min-height: 320px;
  background: linear-gradient(90deg, #121216 0%, #1a1a20 50%, #121216 100%) 0 0 / 200% 100%;
  border-radius: 4px;
  animation: d4pt-loading 1.2s linear infinite;
}

@keyframes d4pt-loading {
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .d4-skill-blocks-planner-root.is-loading { animation: none; }
}

/* theme-guard:start — generated by tools/theme-guard.mjs, do not edit */
html body .d4pt-tab:where(:hover, :focus) { border: none; background: transparent; color: #aaa8b1; }
html body .d4pt-variant:where(:hover, :focus) { border: none; background: #14120f; color: #aaa8b1; }
html body .d4-stepper__nav:where(:hover, :focus),
html body .d4-stepper__current:where(:hover, :focus) { border: 1px solid #4a3b29; background: #14120f; color: #d1bfa0; }
html body .d4-stepper__current:where(:hover, :focus) { color: #f7e0b5; border-color: #c49944; background: linear-gradient(180deg, #2b1f13, #1a130a); }
html body .d4-stepper__option:where(:hover, :focus) { border: 1px solid transparent; background: transparent; color: #ececf1; }
html body .d4fs-close:where(:hover, :focus) { border: 1px solid #4a3b29; background: #14120f; color: #d1bfa0; }
/* theme-guard:end */
