/* staff/pantheon.css - the Pantheon section (staff/pantheon.js): a top-down chart of the gods with a profile panel */
#sec-pantheon {
  --pn-ally: var(--ok);
  --pn-enemy: var(--bad);
  --pn-equiv: var(--gold);
  --pn-line: var(--border);
}

.pn-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.pn-controls .pn-search { flex: 1 1 260px; min-width: 0; }
.pn-controls select { flex: 0 1 auto; min-width: 0; max-width: 100%; }

.pn-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: 0.85rem;
}
.pn-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.pn-key {
  display: inline-block;
  padding: 1px 8px;
  border: 2px solid var(--pn-line);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text);
}
.pn-key.ally { border-color: var(--pn-ally); }
.pn-key.enemy { border-color: var(--pn-enemy); }
.pn-key.equiv { border-color: var(--pn-equiv); }
.pn-key.disputed { border-style: dashed; }

/* Layout: the chart and, once a god is picked, its profile beside it */
.pn-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}
.pn-layout:has(.pn-panel:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); }
.pn-chart { min-width: 0; }
.pn-empty { padding: var(--sp-4); }

/* Groups: each tier is a box; child groups sit in columns under a connector bar */
.pn-group {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--sp-3);
}
.pn-group.depth-1, .pn-group.depth-2, .pn-group.depth-3 { background: var(--panel-soft); }
.pn-tier { margin: 0 auto; }
.pn-tier.pn-joined { margin-top: var(--sp-6); }
.pn-tier.pn-joined::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(-1 * var(--sp-6) - 1px);
  height: var(--sp-6);
  border-left: 2px solid var(--pn-line);
}
.pn-tier.pn-separate { margin-top: var(--sp-8); }
.pn-head { text-align: center; margin-bottom: var(--sp-2); }
.pn-title { margin: 0; font-family: var(--title); color: var(--text-bright); font-size: 1rem; letter-spacing: 0.02em; }
.pn-group.depth-0 > .pn-head .pn-title { font-size: 1.15rem; color: var(--gold); }
.pn-note { margin: 2px 0 0; font-size: 0.8rem; }

.pn-kids {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
}
/* The connector: a bar across the children, a tick down into each */
.pn-kids::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  border-top: 2px solid var(--pn-line);
}
.pn-kids::after {
  content: '';
  position: absolute;
  top: calc(-1 * var(--sp-4));
  left: 50%;
  height: var(--sp-4);
  border-left: 2px solid var(--pn-line);
}
.pn-kids > .pn-group::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--sp-4) - 1px);
  left: 50%;
  height: var(--sp-4);
  border-left: 2px solid var(--pn-line);
}
/* Wide groups (the Aedra and Daedra halves) take the full row when there is room */
.pn-group.depth-1 > .pn-kids { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pn-group[data-key="regional"] > .pn-kids { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Gods */
.pn-gods {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
.pn-family {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  max-width: 100%;
}
.pn-forms {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 2px dotted var(--pn-line);
}
.pn-forms::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--sp-3) - 2px);
  left: 50%;
  height: var(--sp-3);
  border-left: 2px dotted var(--pn-line);
}

.pn-god {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 172px;
  max-width: 100%;
  padding: 6px 8px 8px;
  border: 2px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  background: var(--panel-elevated);
  transition: opacity 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.pn-god.pn-form { width: 150px; }
.pn-god.t-aedra { border-left-color: #c9a64a; }
.pn-god.t-daedric-prince, .pn-god.t-daedric-lord { border-left-color: #9a4e9e; }
.pn-god.t-hero-god, .pn-god.t-demigod { border-left-color: #4f8fb0; }
.pn-god.t-cosmic { border-left-color: #6d6d8a; }
.pn-god.t-spirit { border-left-color: #6e9b62; }
.pn-god.t-faith { border-left-color: #a07850; }

.pn-pick {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.pn-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pn-name { font-weight: 700; color: var(--text-bright); line-height: 1.2; overflow-wrap: anywhere; }
.pn-type { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

.pn-badges, .pn-eqs { display: flex; flex-wrap: wrap; gap: 4px; }
.pn-game {
  display: inline-block;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  line-height: 1.5;
  border: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}
.pn-game.on { color: var(--ok); border-color: var(--ok); }
.pn-game.off { color: var(--text-faint); border-style: dashed; }

.pn-eq {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 0 6px;
  border: 1px solid var(--pn-equiv);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.pn-eq:hover { background: var(--gold-fill); }
.pn-eq:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pn-eq.disputed { border-style: dashed; }
.pn-eq-arrow { color: var(--pn-equiv); }
.pn-disputed {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warn);
  border-left: 1px dashed var(--pn-equiv);
  padding-left: 3px;
}
.pn-eq-more { font-size: 0.72rem; }

/* Selection: the god, its allies (green), enemies (red) and equivalents (gold; dashed when disputed); the rest fade */
.pn-chart.has-selection .pn-god { opacity: 0.45; }
.pn-chart.has-selection .pn-god.is-selected,
.pn-chart.has-selection .pn-god.is-ally,
.pn-chart.has-selection .pn-god.is-enemy,
.pn-chart.has-selection .pn-god.is-equiv { opacity: 1; }
.pn-god.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--glow); }
.pn-god.is-equiv { border-color: var(--pn-equiv); }
.pn-god.is-equiv.is-disputed { border-style: dashed; }
.pn-god.is-ally { border-color: var(--pn-ally); box-shadow: 0 0 0 1px var(--pn-ally); }
.pn-god.is-enemy { border-color: var(--pn-enemy); box-shadow: 0 0 0 1px var(--pn-enemy); }

/* The profile panel */
.pn-panel {
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-3));
  max-height: calc(100vh - var(--topbar-h) - var(--sp-6));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: var(--sp-4);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.pn-p-head { position: relative; padding-right: 64px; }
.pn-close { position: absolute; top: 0; right: 0; }
.pn-p-name { margin: 0 0 4px; font-family: var(--title); color: var(--gold); font-size: 1.3rem; }
.pn-p-sub { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pn-p-pantheons { margin: 6px 0 0; font-size: 0.8rem; }
.pn-p-sphere { margin: var(--sp-3) 0 var(--sp-2); color: var(--text-bright); font-style: italic; }
.pn-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--sp-2); }
.pn-p-sec { margin-top: var(--sp-3); }
.pn-p-sec p { margin: 0; }
.pn-p-h {
  margin: 0 0 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.pn-small { font-size: 0.78rem; margin: 2px 0 4px; }
.pn-ul { margin: 0; padding-left: 1.1em; }
.pn-ul li { margin: 2px 0; }
.pn-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 var(--sp-3); }
.pn-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px var(--sp-3); margin: 0; }
.pn-dl dt { color: var(--text-dim); }
.pn-dl dd { margin: 0; }
.pn-voice {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  background: var(--gold-fill);
}
.pn-voice .pn-p-h { color: var(--gold); }
.pn-lines { margin: var(--sp-2) 0 0; padding-left: 1.1em; font-style: italic; }
.pn-hooks { border-left: 3px solid var(--accent); padding-left: var(--sp-2); }
.pn-uncertain { border-left: 3px dashed var(--warn); padding-left: var(--sp-2); }
.pn-rel { display: flex; flex-wrap: wrap; gap: 4px; }
.pn-relword { font-size: 0.82rem; padding: 0 6px; border-radius: var(--radius-full); border: 1px solid var(--border-subtle); }
.pn-relword.ally { border-color: var(--pn-ally); }
.pn-relword.enemy { border-color: var(--pn-enemy); }
.pn-relgo {
  all: unset;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 8px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  line-height: 1.6;
}
.pn-relgo.ally { border-color: var(--pn-ally); color: var(--pn-ally); }
.pn-relgo.enemy { border-color: var(--pn-enemy); color: var(--pn-enemy); }
.pn-relgo:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pn-eqlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pn-sources a { color: var(--accent); word-break: break-all; }

/* Phone and narrow screens: one column, and the profile as a full-height sheet over the chart */
@media (max-width: 860px) {
  .pn-layout:has(.pn-panel:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .pn-panel {
    position: fixed;
    inset: auto 0 0 0;
    top: var(--topbar-h);
    max-height: none;
    z-index: 60;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
  }
  body.pn-sheet-open { overflow: hidden; }
}
@media (max-width: 600px) {
  .pn-kids, .pn-group.depth-1 > .pn-kids, .pn-group[data-key="regional"] > .pn-kids { grid-template-columns: minmax(0, 1fr); }
  .pn-kids::before { left: 50%; right: auto; }
  .pn-group { padding: var(--sp-2); }
  .pn-god, .pn-god.pn-form { width: calc(50% - 4px); }
  .pn-controls select { flex: 1 1 45%; }
}
