/* The split view (app/Views/split/*), made to look like the addon's window: the list pane on the left (search, a
   collapse-all button, headers with their entries) and the details pane on the right (round icon, name, facts,
   text and the creature rows with their Map Location buttons). Both panes are inset panels of a fixed height
   that scroll inside, like the addon's. */

.split {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 4px;
  height: clamp(460px, calc(100vh - 13.5rem), 940px);
  margin-bottom: 0.5rem;
}

.split-list,
.split-details {
  min-height: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #000;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(107, 79, 39, 0.55), inset 0 0 22px rgba(0, 0, 0, 0.65);
}

/* ---- The list ---------------------------------------------------------------------------------------- */

.split-list {
  display: flex;
  flex-direction: column;
  padding: 10px 6px 6px 8px;
}

.split-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.split-search {
  flex: 1;
  margin: 0;
}

.split-search input[type="search"] {
  height: 30px;
  margin: 0;
  padding: 2px 10px 2px 28px;
  font-size: 0.9rem;
  color: var(--surface-content);
  background: #0b0a08 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='6.5' cy='6.5' r='4.5' fill='none' stroke='%239d8d70' stroke-width='1.8'/><path d='M10 10l4 4' stroke='%239d8d70' stroke-width='1.8' stroke-linecap='round'/></svg>") no-repeat 9px center / 13px;
  border: 1px solid var(--ft-metal);
  border-radius: 9px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

.split-search input[type="search"]:focus {
  border-color: var(--ft-tan);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(198, 175, 141, 0.35);
}

/* The addon's small red square button with a minus or plus. */
.split-toggle,
.map-dialog-close {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ft-gold);
  background: linear-gradient(180deg, #9c2015, #5a0f09 60%, #3d0905);
  border: 1px solid #1d0402;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 180, 120, 0.35), 0 0 0 1px rgba(184, 151, 109, 0.55);
}

.split-toggle:hover,
.map-dialog-close:hover {
  background: linear-gradient(180deg, #b72a1c, #6d140c 60%, #4a0c07);
}

.split-scroll {
  position: relative; /* the entries' offsetTop is measured from here (keeping the selected one in view) */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ft-metal) rgba(0, 0, 0, 0.4);
}

/* A header: a dark bronze bar with an icon, the name, and + or - on the right. */
.split-group {
  margin: 0 0 3px;
  padding: 0;
  border: 0;
}

.split-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 0;
  padding: 3px 10px 3px 5px;
  list-style: none;
  cursor: pointer;
  font-family: var(--ft-font-heading);
  font-size: 1.08rem;
  line-height: 1.2;
  color: var(--surface-content);
  background: linear-gradient(180deg, #3b2817, #24170d);
  border: 1px solid #5c4424;
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 233, 180, 0.12), 0 1px 2px rgba(0, 0, 0, 0.6);
}

.split-group > summary::-webkit-details-marker {
  display: none;
}

.split-group > summary::after {
  content: "+";
  float: none;
  width: auto;
  height: auto;
  margin: 0 0 0 auto;
  background: none;
  transform: none;
  font-family: var(--pico-font-family);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ft-gold);
}

.split-group[open] > summary::after {
  content: "\2212";
  transform: none;
}

/* (Pico dims an open summary; these stay bright, as in the addon.) */
.split-group[open] > summary,
.split-group[open] > summary:not([role]):not(:focus) {
  margin-bottom: 0;
  color: var(--surface-content);
}

.split-group > summary:hover {
  border-color: var(--ft-tan);
  color: #fff;
}

.split-group > summary .forever-icon,
.split-group > summary .type-icon {
  flex: none;
}

.split-group-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-group ul {
  margin: 2px 0 6px;
  padding: 0;
}

.split-group li {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* An entry: plain text, indented; the selected one gets the addon's gold bar. */
.split-group li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 30px;
  font-size: 0.98rem;
  color: #fff;
  text-decoration: none;
  border-radius: 2px;
}

.split-group li a:hover {
  background: rgba(255, 255, 255, 0.06);
}

.split-group li a[aria-current] {
  color: #f1dfb1;
  background: linear-gradient(90deg, rgba(255, 209, 0, 0.3), rgba(255, 209, 0, 0.08) 75%, rgba(255, 209, 0, 0));
  box-shadow: inset 0 -1px 0 rgba(255, 209, 0, 0.65);
}

.split-group li a .forever-icon {
  margin-left: -22px;
}

/* Read by screen readers only. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* An entry's count (a rank's tameable creatures), as a badge on the right. */
.split-count {
  margin-left: auto;
  min-width: 1.9em;
  padding: 0 0.45em;
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
  color: var(--ft-tan);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #5c4424;
  border-radius: 999px;
  flex-shrink: 0; /* stays one line beside a long, wrapping label */
  white-space: nowrap;
}

.split-group li a[aria-current] .split-count {
  color: var(--ft-gold);
  border-color: rgba(255, 209, 0, 0.55);
}

/* Every creature counted has been tamed: the badge in the Tamed seal's green (.tamed-badge), also when selected. */
.split-count.split-count--complete,
.split-group li a[aria-current] .split-count.split-count--complete {
  color: #b9f0c4;
  background: rgba(30, 90, 45, 0.55);
  border-color: #3c7a4a;
}

/* Trainers by faction, as in the addon. */
.side-alliance { color: var(--ft-alliance) !important; }
.side-horde { color: var(--ft-horde) !important; }

.split-empty {
  margin: 1rem 0;
  text-align: center;
  color: var(--ft-muted);
}

.type-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  vertical-align: -4px;
  box-shadow: 0 0 0 1px #000;
}

/* ---- The details ------------------------------------------------------------------------------------- */

.split-details {
  display: flex;
  flex-direction: column;
  padding: 22px 20px 12px 24px;
  overflow-y: auto; /* when the top part alone is taller than the pane */
}

.detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

/* The round icon in a bronze ring, like the profession window's recipe icon. */
.detail-icon {
  display: block;
  width: 70px;
  height: 70px;
  padding: 4px;
  border-radius: 50%;
  background: linear-gradient(160deg, #e2c08a, #8a6431 45%, #4a3216 75%, #b8976d);
  box-shadow: 0 0 0 1px #000, 0 3px 8px rgba(0, 0, 0, 0.75);
}

.detail-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid #000;
  border-radius: 50%;
}

.detail-title h2 {
  margin: 10px 0 6px;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.15;
  color: #fff;
}

.detail-title p {
  margin: 0;
  font-family: var(--ft-font-heading);
  color: var(--ft-gold);
}

/* A subtitle that is text to read (a bounty's explanation): white body text across the pane, not the gold line. */
.detail-title p.detail-title-text {
  font-family: var(--pico-font-family);
  font-size: 1rem;
  line-height: 1.4;
  color: #fff;
}

/* A family's ability rows under its unique ability, as the addon's: "Common: [icons]", "Passive: [icons]". */
.detail-ability-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.86rem;
}

.detail-ability-label {
  flex: none;
  color: var(--ft-gold);
}

.detail-ability-row .detail-icons {
  gap: 3px;
  margin: 0;
}

/* How to Claim's numbered steps. */
.detail-steps {
  margin: 0 0 12px;
  padding-left: 1.4rem;
  color: #fff;
  line-height: 1.45;
}

.detail-steps li {
  margin-bottom: 4px;
}

.detail-facts {
  max-width: 22rem;
  margin: 6px 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
}

.detail-facts > div {
  margin: 0;
}

.detail-facts dt,
.detail-facts dd {
  display: inline;
  margin: 0;
  font-weight: 400;
}

.detail-facts dt {
  color: var(--ft-gold);
}

.detail-facts dd {
  color: #fff;
}

.detail-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.detail-description {
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.4;
  color: #fff;
}

.detail-stats {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--ft-muted);
}

/* The Wowhead fact: its icon, the height of a line of the facts. */
.wowhead-link {
  display: inline-block;
  vertical-align: -3px;
  line-height: 0;
}

.wowhead-link img {
  width: 16px;
  height: 16px;
}

.wowhead-link:hover img {
  filter: brightness(1.25) drop-shadow(0 0 3px rgba(255, 209, 0, 0.5));
}

.detail-label {
  margin: 10px 0 6px;
  font-family: var(--pico-font-family);
  font-size: 1rem;
  font-weight: 400;
  color: var(--ft-gold);
  text-shadow: none;
}

.detail-note {
  margin: 0;
  color: var(--ft-muted);
}

.detail-ability {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

/* The creature rows: name in the addon's blue, level and zone under it, Map Location on the right. They scroll
   inside the pane, under the rest. */
.npc-list {
  flex: 1 1 auto;
  min-height: 140px;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ft-metal) rgba(0, 0, 0, 0.4);
}

.npc-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 2px;
  padding: 4px 6px;
  list-style: none;
  background: rgba(255, 255, 255, 0.045);
}

.npc-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.npc-name {
  overflow: hidden;
  font-size: 1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ft-npc);
  text-decoration: none;
}

.npc-name:hover {
  color: #6fd2f2;
  text-decoration: underline;
}

.npc-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.npc-line .elite-icon {
  flex: none;
  width: 15px;
  height: 15px;
}

.npc-info {
  overflow: hidden;
  font-size: 0.82rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ft-muted);
}

/* The game's red panel button. */
/* The Map button: a quiet bronze-edged button that lights up under the pointer, so a long list of creatures leads with
   their names. (.split-details button.: as specific as the site's red buttons, addon-theme.css, and after them.) */
.split-details button.map-button {
  flex: none;
  width: auto;
  margin: 0;
  padding: 2px 10px;
  font-family: var(--ft-font-heading);
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--ft-tan);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ft-metal);
  border-radius: 3px;
  box-shadow: none;
}

.split-details button.map-button:hover:not(:disabled) {
  color: var(--ft-gold);
  background: rgba(0, 0, 0, 0.45);
  border-color: var(--ft-gold);
}

/* No map of where it is: Unavailable, dimmed, with a dashed edge. */
.split-details button.map-button:disabled {
  opacity: 0.5;
  border-style: dashed;
  cursor: default;
}

/* A trainer's zone map, as wide as the details pane: a button that opens the larger one. */
.detail-map {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  background: none;
  cursor: zoom-in;
}

.split-details > .detail-body > .map-button {
  align-self: flex-start;
}

/* A trainer's Map button: as wide as the map above it, as in the addon. */
.split-details > .detail-body > .map-button--wide {
  width: 100%;
}

/* ---- Map Location dialog ----------------------------------------------------------------------------- */

.map-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.map-dialog > .map-panel {
  width: min(1000px, 94vw);
  max-width: none;
  max-height: 92vh;
  margin: 0;
  padding: 14px 18px 8px;
  overflow: auto;
  background: linear-gradient(180deg, #1e1b18, #110f0d);
  border: 4px solid var(--ft-metal);
  border-image: linear-gradient(160deg, var(--ft-metal-light), var(--ft-metal) 38%, var(--ft-metal-dark) 62%, var(--ft-metal) 82%, var(--ft-metal-light)) 1;
  border-radius: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.map-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 10px;
  padding: 0;
  background: none;
  border: 0;
}

.map-dialog-head h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--ft-gold);
}

.map-zone {
  margin: 0 0 12px;
}

.map-zone figcaption {
  margin-bottom: 4px;
  font-family: var(--ft-font-heading);
  color: var(--ft-tan);
}

/* ---- Narrow windows: the list above the details --------------------------------------------------------- */

/* The phone's picker (split/_list.php): hidden on wide windows, where the list is always shown. */
.split-picker {
  display: none;
}

@media (max-width: 800px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
  }

  /* Without the script: the list as it is, in a box of its own. */
  .split-list {
    max-height: 40vh;
  }

  /* With it (public/js/split.js): the list folds into one button naming the selected entry, the details right under
     it; the button opens the list, and choosing an entry folds it again. */
  .split-list--picker {
    max-height: none;
    padding: 6px;
  }

  /* (button.: more specific than the site's red buttons, addon-theme.css) */
  .split-list--picker button.split-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.75rem;
    text-align: left;
    color: var(--surface-content);
    background: linear-gradient(180deg, #3b2817, #24170d);
    border: 1px solid #5c4424;
    border-radius: 3px;
    box-shadow: inset 0 1px 0 rgba(255, 233, 180, 0.12), 0 1px 2px rgba(0, 0, 0, 0.6);
  }

  .split-list--picker button.split-picker:hover {
    color: var(--surface-content);
    background: linear-gradient(180deg, #4a321c, #2c1c10);
  }

  .split-picker__text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
  }

  .split-picker__text small {
    color: var(--ft-tan);
    font-size: 0.78rem;
  }

  .split-picker__text small:empty {
    display: none;
  }

  .split-picker__text span {
    overflow: hidden;
    color: var(--ft-gold);
    font-family: var(--ft-font-heading);
    font-size: 1.1rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .split-picker__hint {
    flex: none;
    color: var(--ft-tan);
    font-size: 0.85rem;
  }

  .split-picker__hint::after {
    content: " \25BE";
  }

  .split-list--picker.is-open .split-picker__hint::after {
    content: " \25B4";
  }

  .split-list--picker:not(.is-open) > .split-toolbar,
  .split-list--picker:not(.is-open) > .split-scroll {
    display: none;
  }

  .split-list--picker.is-open > .split-toolbar {
    margin-top: 8px;
  }

  .split-list--picker.is-open > .split-scroll {
    max-height: 60vh;
  }

  .split-details {
    overflow: visible;
  }

  .npc-list {
    overflow: visible;
  }

  .detail-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .detail-facts {
    grid-column: 1 / -1;
    max-width: none;
  }
}

/* Many points in one zone: smaller pins in the dialog, so they do not cover each other (and the map). */
.map-panel .zone-pin {
  width: 14px;
  height: 14px;
}

/* Phones: the section tabs as one strip that scrolls sideways (the current one starts in view: public/js/split.js),
   fading out at the right edge to show there is more. The padding lets the last tab scroll clear of the fade. */
@media (max-width: 800px) {
  main > nav.top-nav ul.top-tabs {
    position: relative; /* (the tabs' offsetLeft is measured from here) */
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 2.5rem;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
  }

  main > nav.top-nav ul.top-tabs::-webkit-scrollbar {
    display: none;
  }

  main > nav.top-nav ul.top-tabs li {
    flex: none;
  }

  main > nav.top-nav ul.top-tabs a[role="button"] {
    white-space: nowrap;
  }
}

/* Narrow windows: the section tabs under the title, closer together. */
@media (max-width: 1099px) {
  main > nav.top-nav ul.top-tabs {
    gap: 0.4rem;
    row-gap: 0.4rem;
  }

  main > nav.top-nav ul.top-tabs li {
    padding: 0;
  }

  main > nav.top-nav ul.top-tabs a[role="button"] {
    padding: 0.4rem 0.75rem;
    font-size: 0.92rem;
  }
}

/* A creature verified by a tame (pets.last_tamed): a small green seal after its name. */
.tamed-badge {
  flex: none;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #b9f0c4;
  background: rgba(30, 90, 45, 0.55);
  border: 1px solid #3c7a4a;
  border-radius: 999px;
  cursor: help;
}

/* The tick: drawn (not a character, which some systems show as a colored emoji), in white. */
.tamed-badge .tamed-check {
  width: 0.95em;
  height: 0.95em;
  margin-right: 3px;
  vertical-align: -0.12em;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A creature seen in the wild in an upload but not tamed yet (tame_badges): a grey eye after its name, where a tamed
   one has its seal; the addon draws the same mark. */
.sighted-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  margin-left: 6px;
  color: var(--ft-muted);
  cursor: help;
}

.sighted-badge svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.sighted-badge svg circle {
  fill: currentColor;
  stroke: none;
}

/* A creature the game refuses to tame (pets.not_tameable): the same seal, in red, with a cross. */
.tamed-badge.tamed-badge--not {
  color: #ffc4bd;
  background: rgba(120, 28, 22, 0.6);
  border-color: #a8443a;
}

/* A rare creature: the row glows gold from the left, as in the old tables (tr.rare). */
.npc-list li.rare {
  background: linear-gradient(90deg, rgba(255, 209, 0, 0.16), rgba(255, 209, 0, 0.03) 70%), rgba(255, 255, 255, 0.045);
  box-shadow: inset 2px 0 0 rgba(255, 209, 0, 0.6);
}

/* A creature added in WoW Forever (1.60 or later): ♾️ before its name, like the elite skull. */
.npc-line .forever-mark {
  flex: none;
  font-size: 0.9em;
  line-height: 1;
}

/* A family new in WoW Forever (Fox): ♾️ after its name in the list, before it in the details heading. */
.split-list .forever-mark {
  flex: none;
  margin-left: 4px;
  font-size: 0.85em;
  line-height: 1;
}

.detail-title h2 .forever-mark {
  font-size: 0.8em;
}

/* An attack speed no tame has confirmed (the attack speed pages): a grey ?, as the addon greys the speed. */
.speed-unconfirmed {
  margin-left: 6px;
  color: var(--ft-muted);
  font-weight: 600;
  cursor: help;
}
