/* Pal Atlas merged topic hubs - 2026-09-02 phase 2 */
.topic-hub {
  display: grid;
  gap: 18px;
}

.topic-hub-head {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line, rgba(255,255,255,.10));
  background: linear-gradient(135deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
}

.topic-hub-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: clamp(110px, 19vw, 260px);
  height: 2px;
  background: var(--accent, #d90a2c);
  box-shadow: 0 0 18px rgba(217,10,44,.55);
}

.topic-hub-kicker {
  margin: 0 0 8px;
  color: var(--accent, #d90a2c);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.topic-hub-head h2 {
  margin: 0;
  color: var(--text, #fff);
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.03;
  letter-spacing: -.035em;
}

.topic-hub-head p:last-child {
  max-width: 820px;
  margin: 12px 0 0;
  color: var(--muted, rgba(255,255,255,.66));
  line-height: 1.65;
}

.topic-tabs-wrap {
  position: sticky;
  top: var(--pal-atlas-sticky-top, 72px);
  z-index: 24;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line, rgba(255,255,255,.10));
  background: rgba(8,8,11,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}

.topic-tabs {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-inline: contain;
}

.topic-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted, rgba(255,255,255,.64));
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .16s ease, background .16s ease, transform .16s ease;
  white-space: nowrap;
}

.topic-tab::after {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 4px;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--accent, #d90a2c);
  box-shadow: 0 0 12px rgba(217,10,44,.5);
  transition: transform .18s ease;
}

.topic-tab:hover,
.topic-tab:focus-visible {
  color: var(--text, #fff);
  background: rgba(255,255,255,.045);
}

.topic-tab.active {
  color: var(--text, #fff);
  background: rgba(217,10,44,.08);
}

.topic-tab.active::after { transform: scaleX(1); }
.topic-tab:focus-visible { outline: 2px solid rgba(217,10,44,.65); outline-offset: 2px; }

.topic-hub-panel { min-width: 0; }
.topic-hub-panel > .guide-page,
.topic-hub-panel > .data-page,
.topic-hub-panel > section:first-child { margin-top: 0; }

@media (max-width: 900px) {
  .topic-tabs-wrap { top: 62px; }
}

@media (max-width: 640px) {
  .topic-hub { gap: 12px; }
  .topic-hub-head { padding: 18px; }
  .topic-tabs-wrap {
    top: 58px;
    margin-inline: -4px;
    padding: 6px;
  }
  .topic-tab {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 11px;
  }
  .topic-tab::after { left: 12px; right: 12px; }
}


/* Dense hubs can carry 5-6 tabs; keep them usable without wrapping. */
.topic-hub-breeding .topic-tabs,
.topic-hub-equipment .topic-tabs,
.topic-hub-skills .topic-tabs { scroll-padding-inline: 8px; }

.topic-hub-panel > :first-child { scroll-margin-top: 140px; }

@media (max-width: 640px) {
  .topic-hub-head h2 { font-size: clamp(25px, 8vw, 36px); }
  .topic-hub-head p:last-child { font-size: 13px; }
}

/* Phase 3 - crawlable tabs, guide markers, consistent tab loaders and dark hub fixes. */
.topic-tab {
  text-decoration: none !important;
}

.topic-tab.is-guide-start {
  margin-left: 0;
}

.topic-tab-guide-mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 7px;
  flex: 0 0 18px;
  border-radius: 50%;
  background: #d90a2c;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 0 rgba(217,10,44,.28);
  transition: transform .16s ease, box-shadow .16s ease;
}

.topic-tab:hover .topic-tab-guide-mark,
.topic-tab:focus-visible .topic-tab-guide-mark {
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(217,10,44,.42);
}

.topic-tab-guide-mark::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  z-index: 40;
  transform: translate(-50%, -3px);
  padding: 5px 7px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  background: #050507;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
  box-shadow: 0 8px 22px rgba(0,0,0,.35);
}

.topic-tab-guide-mark:hover::after,
.topic-tab:focus-visible .topic-tab-guide-mark::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.topic-hub-panel {
  position: relative;
  min-width: 0;
}

.topic-hub-panel.is-tab-loading {
  min-height: clamp(320px, 48vh, 620px);
  overflow: hidden;
}

.topic-tab-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  min-height: clamp(320px, 48vh, 620px);
  padding: 20px;
  background: #050507;
}

.topic-tab-loading > .pal-atlas-loading-overlay,
.topic-hub-panel .pal-atlas-loading-overlay.is-compact {
  width: 100% !important;
  min-height: 300px !important;
  margin: 0 !important;
  padding: 28px 18px !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  background: #050507 !important;
}

.topic-hub-stage.is-preparing {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
}

/* Database modules sometimes place a compact loader inside a grid/column layout.
   Force that loader to span the content width and stay centered. */
.topic-hub-panel .active-skills-grid > .pal-atlas-loading-overlay,
.topic-hub-panel .skill-fruits-grid > .pal-atlas-loading-overlay,
.topic-hub-panel .passive-db-grid > .pal-atlas-loading-overlay,
.topic-hub-panel .technology-grid > .pal-atlas-loading-overlay,
.topic-hub-panel .recommendation-grid > .pal-atlas-loading-overlay {
  width: 100% !important;
  max-width: none !important;
  min-height: 320px !important;
  column-span: all;
  grid-column: 1 / -1 !important;
}

/* Active Skills is now nested inside #view-skills, so old route-specific dark
   selectors no longer match. Keep the database fully dark inside the hub. */
.topic-hub-skills .active-skills-controls,
.topic-hub-skills .active-skill-card,
.topic-hub-skills .active-skill-card-head,
.topic-hub-skills .active-skill-stats > div,
.topic-hub-skills .active-skill-description,
.topic-hub-skills .skill-sources,
.topic-hub-skills .active-skills-empty {
  background: #0d0d11 !important;
  border-color: #34343c !important;
  color: #f6f6f8 !important;
}

.topic-hub-skills .active-skills-filter-grid input,
.topic-hub-skills .active-skills-filter-grid select,
.topic-hub-skills .active-skill-type {
  background: #131318 !important;
  border-color: #34343c !important;
  color: #fff !important;
}

.topic-hub-skills .active-skill-description {
  background: #131318 !important;
}

.topic-hub-skills .active-skill-card .skill-sources {
  border-top-color: #34343c !important;
}

/* Pal chips: black fill + crisp white border, as requested. */
.topic-hub-skills .learned-by-pal,
#view-active-skills .learned-by-pal {
  background: #09090d !important;
  border: 1px solid rgba(255,255,255,.92) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.topic-hub-skills .learned-by-pal strong,
#view-active-skills .learned-by-pal strong {
  color: #fff !important;
}

.topic-hub-skills .learned-by-pal span span,
#view-active-skills .learned-by-pal span span {
  color: #a9a9b2 !important;
}

.topic-hub-skills .learned-by-pal:not(.js-no-details):hover,
#view-active-skills .learned-by-pal:not(.js-no-details):hover {
  background: #15151b !important;
  border-color: #d90a2c !important;
}

/* Keep the real Palworld element icon only - no colored square behind it. */
body.pal-atlas-page .pal-atlas-layout span.active-skill-element-icon[class*="element-"] {
  background: transparent !important;
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.pal-atlas-page .pal-atlas-layout span.active-skill-element-icon[class*="element-"] img {
  background: transparent !important;
}

/* Passive Transfer is nested inside #view-breeding after the merge. The module
   still injects a white hero; override it inside both the hub and legacy route. */
.topic-hub-breeding .pt-hero,
#view-passive-transfer .pt-hero {
  background: linear-gradient(135deg,#0d0d11,#09090d 62%,rgba(217,10,44,.12)) !important;
  border: 1px solid #34343c !important;
  color: #fff !important;
}

.topic-hub-breeding .pt-hero h1,
.topic-hub-breeding .pt-hero h2,
.topic-hub-breeding .pt-hero strong,
.topic-hub-breeding .pt-hero p,
#view-passive-transfer .pt-hero h1,
#view-passive-transfer .pt-hero h2,
#view-passive-transfer .pt-hero strong,
#view-passive-transfer .pt-hero p {
  color: #fff !important;
}

.topic-hub-breeding .pt-hero p,
#view-passive-transfer .pt-hero p {
  color: #c4c4cc !important;
}

@media (max-width: 760px) {
  .topic-tabs {
    gap: 5px;
    scroll-snap-type: x proximity;
  }

  .topic-tab {
    scroll-snap-align: start;
  }

  .topic-tab.is-guide-start {
    margin-left: 0;
  }

  .topic-tab-guide-mark {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
    margin-left: 6px;
    font-size: 10px;
  }

  .topic-hub-panel.is-tab-loading,
  .topic-tab-loading {
    min-height: clamp(280px, 52vh, 520px);
  }
}


/* Guide tooltip uses native title/aria on touch devices; avoid hover boxes sticking. */
@media (hover: none) {
  .topic-tab-guide-mark::after { display: none; }
}

/* Phase 4: tab bars stay centered as a block, with every tab left-aligned in one row. */
.topic-tabs-wrap {
  width: 100%;
  margin-inline: auto;
}
.topic-tabs {
  justify-content: flex-start;
}
.topic-tab.is-guide-start {
  margin-left: 0 !important;
}


/* Phase 5: vertically center every merged hub tab inside its tab rail. */
.topic-tabs-wrap {
  min-height: 70px;
  display: flex;
  align-items: center;
}

.topic-tabs {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 54px;
  align-items: center !important;
}

.topic-tab {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center;
  gap: 0;
  min-height: 52px;
  height: 52px;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.1 !important;
  vertical-align: middle;
}

.topic-tab-label {
  display: inline-flex;
  align-items: center;
  line-height: 1.1;
}

.topic-tab-guide-mark {
  align-self: center;
}

.topic-tab::after {
  bottom: 5px;
}

@media (max-width: 640px) {
  .topic-tabs-wrap {
    min-height: 62px;
  }

  .topic-tabs {
    min-height: 48px;
  }

  .topic-tab {
    min-height: 46px;
    height: 46px;
  }

  .topic-tab::after {
    bottom: 4px;
  }
}


/* 2026-09-03: no-scroll topic tabs.
   Tabs wrap cleanly instead of creating horizontal/vertical scrollbars.
   Guide tooltips are allowed to render outside the rail without clipping. */
.topic-tabs-wrap {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.topic-tabs {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  align-content: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  scrollbar-width: none !important;
  overscroll-behavior: auto !important;
}

.topic-tabs::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.topic-tab {
  flex: 0 0 auto !important;
  max-width: 100%;
}

.topic-tab-guide-mark {
  overflow: visible !important;
}

.topic-tab-guide-mark::after {
  z-index: 999 !important;
}

@media (max-width: 640px) {
  .topic-tabs-wrap {
    min-height: 0 !important;
    padding: 7px !important;
  }

  .topic-tabs {
    gap: 6px !important;
  }

  .topic-tab {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 46px !important;
    padding: 9px 11px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    text-align: center;
  }

  .topic-tab-label {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}
