/* ==========================================================================
   The deck hub — browse, inspect, mine.
   Same gold-on-navy system as the table: HD art is the hero, chrome is a thin
   overlay on top of it. Deck pages are the one place vertical scroll is allowed.
   ========================================================================== */

/* ------------------------------------------------------------------ tabs -- */

.hub-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--gold-line); margin-bottom: var(--s4); }
.hub-tab {
  padding: 7px 16px 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.hub-tab:hover { color: var(--gold-hi); }
.hub-tab.on { color: var(--gold-hi); border-bottom-color: var(--gold); }

/* domain pips are used by tiles, charts and the filter rail alike */
.pip { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--gold); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); flex: 0 0 auto; }
.pip[data-domain='fury'] { background: var(--d-fury); }
.pip[data-domain='calm'] { background: var(--d-calm); }
.pip[data-domain='mind'] { background: var(--d-mind); }
.pip[data-domain='body'] { background: var(--d-body); }
.pip[data-domain='chaos'] { background: var(--d-chaos); }
.pip[data-domain='order'] { background: var(--d-order); }
.pip[data-domain='colorless'] { background: var(--ink-mute); }

/* ------------------------------------------------------------ filter rail -- */

.hub-grid { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.hub-rail { position: sticky; top: 0; display: flex; flex-direction: column; max-height: calc(100dvh - 120px); overflow: hidden; }
.hub-rail-top { display: grid; gap: 6px; padding: var(--s3); border-bottom: 1px solid var(--gold-line); }
.hub-rail-body { padding: var(--s3); display: flex; flex-direction: column; gap: var(--s4); }

.hub-facet-title { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 7px; }
.hub-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.facet-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font: inherit;
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.facet-chip:hover { color: var(--gold-hi); border-color: var(--gold-line-hi); }
.facet-chip .num { font-size: 10px; color: var(--ink-mute); }
.facet-chip.on { color: #16110b; background: linear-gradient(180deg, #d8bb7c, #9c7c3e); border-color: #e6d1a1; }
.facet-chip.on .num { color: rgba(22, 17, 11, 0.7); }
/* a domain filter wears its own colour, so the rail reads at a glance */
.facet-chip[data-domain]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--fc, var(--gold)); }
.facet-chip[data-domain='fury'] { --fc: var(--d-fury); }
.facet-chip[data-domain='calm'] { --fc: var(--d-calm); }
.facet-chip[data-domain='mind'] { --fc: var(--d-mind); }
.facet-chip[data-domain='body'] { --fc: var(--d-body); }
.facet-chip[data-domain='chaos'] { --fc: var(--d-chaos); }
.facet-chip[data-domain='order'] { --fc: var(--d-order); }

.seg { display: flex; border: 1px solid var(--gold-line); border-radius: var(--r-md); overflow: hidden; }
.seg-btn { flex: 1 1 0; padding: 5px 4px; font: inherit; font-size: 11px; background: transparent; border: 0; border-right: 1px solid var(--gold-line); color: var(--ink-soft); cursor: pointer; }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--gold-hi); background: rgba(200, 170, 110, 0.1); }
.seg-btn.on { color: var(--gold-hi); background: rgba(200, 170, 110, 0.2); box-shadow: inset 0 -2px 0 var(--gold); }

.legend-picker { display: flex; flex-direction: column; gap: 3px; max-height: 320px; overflow-y: auto; }
.legend-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.legend-pick:hover { background: rgba(200, 170, 110, 0.1); color: var(--gold-hi); }
.legend-pick.on { border-color: var(--gold); background: rgba(200, 170, 110, 0.16); color: var(--gold-hi); }
/* the legend's printed portrait, cropped to the face */
.legend-face {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--navy-700) center 22% / 165% no-repeat;
  box-shadow: 0 0 0 1px var(--gold-line);
}
.legend-pick .legend-name { flex: 1 1 auto; min-width: 0; }
.legend-n { font-size: 10px; color: var(--ink-mute); }

/* --------------------------------------------------------------- results -- */

.hub-count { margin-bottom: var(--s2); }
.hub-deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: var(--s3); }
.hub-pager { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s4); }

.hub-card {
  border: 1px solid var(--gold-line);
  border-radius: var(--r-lg);
  background: var(--glass);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast), box-shadow var(--t-fast);
}
.hub-card:hover { transform: translateY(-3px); border-color: var(--gold-line-hi); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6); }
.hub-card-art {
  position: relative;
  display: block;
  height: 128px;
  background: var(--navy-800) center 18% / cover no-repeat;
  border-bottom: 1px solid var(--gold-line);
}
.hub-card-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 6, 13, 0.15) 0%, transparent 35%, rgba(8, 13, 26, 0.9) 100%); }
.hub-card .hub-pips { position: absolute; left: 8px; top: 8px; z-index: 1; display: flex; gap: 3px; }
.hub-card-legend {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy-700) center 20% / 165% no-repeat;
  box-shadow: 0 0 0 1px var(--gold-line-hi), 0 3px 10px rgba(0, 0, 0, 0.7);
}
.hub-card-badge { position: absolute; right: 8px; bottom: 8px; z-index: 1; }
.hub-card-tourney { position: absolute; right: 8px; top: 8px; z-index: 1; }

.hub-card-body { padding: 9px 11px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; }
.hub-card-name { font-family: var(--font-display); font-size: 14px; color: var(--gold-hi); display: block; }
.hub-card-name:hover { color: #fff; }
.hub-card-legend-name { color: var(--ink-soft); }
.hub-card-desc { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hub-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold-line); border-radius: var(--r-sm); padding: 1px 6px; }
a.tag:hover { color: var(--gold-hi); border-color: var(--gold-line-hi); }
.hub-card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.hub-card-actions { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.btn.like { display: inline-flex; gap: 4px; }
.btn.like.on { color: #ff9d92; border-color: rgba(226, 88, 74, 0.5); }

/* ------------------------------------------------------------ inspect --- */

.deck-page .page-head { align-items: flex-start; }
.deck-stats-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s4); }

.deck-hero {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  align-items: flex-start;
  padding: var(--s4);
  margin-bottom: var(--s4);
  border: 1px solid var(--gold-line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--glass-hi), var(--glass));
}
.hero-bfs { display: flex; gap: var(--s3); flex-wrap: wrap; }
.hero-leaders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); min-width: 0; max-width: 100%; }
.hero-leaders .hero-slot { max-width: 190px; min-width: 0; }
.hero-leaders .hero-slot-title { font-size: 11px; letter-spacing: 0.12em; }
.hero-card-button { display: block; width: 100%; padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: inherit; cursor: pointer; }
.hero-card-button .card { width: 100%; height: auto; aspect-ratio: 744 / 1039; }
.hero-card-button:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 5px; }
.hero-card-button:hover { filter: brightness(1.08); }
.leader-detail { display: flex; align-items: flex-start; gap: var(--s4); }
.leader-detail > .card { flex: 0 0 auto; }
.leader-rules { white-space: pre-line; line-height: 1.6; }
@media (max-width: 600px) {
  .hero-leaders { width: 100%; }
  .hero-leaders .hero-slot { max-width: none; }
  .hero-leaders .hero-empty { width: 100%; }
  .leader-detail { flex-direction: column; align-items: center; }
  .leader-detail > .card { max-width: 100%; }
}
.hero-slot { display: flex; flex-direction: column; gap: 5px; align-items: center; max-width: 160px; }
.hero-slot-title { font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); }
.hero-slot-name { color: var(--ink-soft); max-width: 100%; }
.hero-empty {
  width: var(--w);
  height: calc(var(--w) * var(--card-ratio));
  border: 1px dashed var(--gold-line);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
}

.deck-body-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s4); align-items: start; }
.deck-cards-body { padding: var(--s3) var(--s4) var(--s4); }
.deck-side { display: flex; flex-direction: column; gap: var(--s3); }

.deck-group + .deck-group { margin-top: var(--s5); }
.deck-group-title {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--gold-line);
  padding-bottom: 4px;
  margin-bottom: var(--s3);
}
.deck-group-title .num { color: var(--ink-soft); }
.deck-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s3); }
.deck-card-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.deck-card-cell .card { width: 100%; height: auto; aspect-ratio: 744 / 1039; }
.deck-card-cell .card[data-orient='landscape'] { aspect-ratio: 1038 / 744; }
.cell-count {
  position: absolute;
  right: -3px;
  top: -5px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  color: #16110b;
  background: linear-gradient(180deg, #f0dcae, #a3762c);
  border-radius: 999px;
  padding: 1px 7px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}
.cell-name { color: var(--ink-soft); max-width: 100%; text-align: center; }

/* ---------------------------------------------------------------- charts -- */

.chart + .chart { margin-top: var(--s4); }
.chart-title { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: var(--s2); }

.curve { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; align-items: end; height: 110px; }
.curve-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.curve-n { font-size: 10px; color: var(--gold-hi); height: 12px; }
.curve-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--gold), var(--gold-dim));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.curve-x { font-size: 10px; color: var(--ink-mute); }

.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; border: 1px solid var(--gold-line); }
.split-seg { background: var(--gold); }
.split-seg[data-domain='fury'] { background: var(--d-fury); }
.split-seg[data-domain='calm'] { background: var(--d-calm); }
.split-seg[data-domain='mind'] { background: var(--d-mind); }
.split-seg[data-domain='body'] { background: var(--d-body); }
.split-seg[data-domain='chaos'] { background: var(--d-chaos); }
.split-seg[data-domain='order'] { background: var(--d-order); }
.split-seg[data-domain='colorless'] { background: var(--ink-mute); }
.split-key { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: var(--s2); font-size: 11px; color: var(--ink-soft); }
.split-item { display: inline-flex; align-items: center; gap: 5px; }
.split-item .num { font-size: 10px; }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 26px; align-items: center; gap: 7px; font-size: 11.5px; }
.bar-label { color: var(--ink-soft); }
.bar-track { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.bar-n { text-align: right; color: var(--gold-hi); font-size: 11px; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .deck-body-grid { grid-template-columns: 1fr; }
  .deck-side { flex-direction: row; flex-wrap: wrap; }
  .deck-side > .panel { flex: 1 1 280px; }
}
@media (max-width: 860px) {
  .hub-grid { grid-template-columns: 1fr; }
  .hub-rail { position: static; max-height: none; }
  .legend-picker { max-height: 220px; }
}
