/* The Delvers' Guild and its contract board.
 *
 * One of the stylesheets split out of the old style.css. index.html links them
 * in the order they had in that file, so the cascade is unchanged - keep
 * that order when adding a rule, or a later sheet may win where it used to lose. */

/* --- Delvers' Guild & Contract Board ------------------------------------- */
.guild-modal:not(.npc-service-modal) {
  width: min(960px, calc(var(--safe-vw) * .95)) !important;
  max-height: calc(var(--safe-dvh) * .88) !important;
  padding: 16px 20px !important;
  display: flex;
  flex-direction: column;
}

.guild-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(200, 153, 72, 0.3);
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.guild-header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.guild-close-btn {
  padding: 6px 14px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
  margin-top: 0 !important;
  width: auto !important;
  align-self: center;
}

.guild-title-block h2 {
  margin: 0 0 4px 0;
  border-bottom: none;
  padding-bottom: 0;
  font-size: 20px;
}

.guild-subtitle {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.guild-rank-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.rank-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
}

.renown-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.renown-label {
  font-size: 10px;
  color: var(--muted);
}

.renown-label strong {
  color: #f4e8c9;
}

.renown-bar {
  width: 140px;
  height: 6px;
  background: #0b0d10;
  border: 1px solid #3b3328;
  border-radius: 2px;
  overflow: hidden;
}

.renown-fill {
  height: 100%;
  background: linear-gradient(90deg, #8a6528, var(--gold));
  transition: width 0.3s ease;
}

/* Guild Modal Body 2-Column Grid */
.guild-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-height: 0;
  flex: 1;
}
.guild-modal-body.has-active-contract { grid-template-columns: minmax(240px, 34%) minmax(0, 1fr); }

.guild-col-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.guild-col-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Scout NPC dialog panel */
.guild-scout-panel {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--row);
  border-radius: 2px;
  padding: 10px 12px;
  margin-bottom: 0;
}

.scout-avatar {
  font-size: 20px;
  color: var(--gold);
  line-height: 1;
}

.scout-dialog {
  font-size: 11px;
  color: #c8bfaa;
  line-height: 1.35;
}

.scout-dialog strong {
  color: #eddcb9;
  display: block;
  margin-bottom: 2px;
}

/* Active Contract Card */
.guild-active-section {
  margin-bottom: 0;
}

.active-contract-card {
  background: var(--row-hover);
  border-left: 2px solid var(--gold);
  padding: 12px;
  border-radius: 2px;
  margin-top: 6px;
}

.active-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.active-card-top strong {
  font-size: 13px;
  color: #f4e8c9;
}

.contract-status-chip {
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(111, 158, 79, 0.14);
  color: #a9c58a;
  border-radius: 2px;
}

.contract-desc {
  margin: 0 0 8px 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.contract-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.contract-progress-bar {
  flex: 1;
  height: 8px;
  background: #090b0d;
  border: 1px solid #3d392f;
  border-radius: 2px;
  overflow: hidden;
}

.contract-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4d8236, #7ab55c);
  transition: width 0.25s ease;
}

.contract-counter {
  font-size: 11px;
  font-weight: 700;
  color: #f4e8c9;
  white-space: nowrap;
}

.active-contract-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.contract-rewards-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--row-hover);
  border-radius: 2px;
  font-size: 11px;
  color: #dfd4be;
}

.reward-chip.gold { color: var(--gold); }
.reward-chip.cores { color: #9fb8d6; }
.reward-chip.supply { color: #a9c58a; }
.reward-chip.renown { color: #e5b65a; }

/* Available Contracts Board */
.guild-board-section .eyebrow {
  margin-bottom: 6px;
}

.guild-contracts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  overflow-y: auto;
  max-height: calc(var(--safe-dvh) * .88 - 120px);
  padding-right: 4px;
}

.guild-contract-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--row);
  padding: 10px 12px;
  transition: background 0.15s ease;
}

.guild-contract-card:hover {
  background: var(--row-hover);
}

.contract-card-info {
  flex: 1;
  min-width: 0;
}

.contract-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.contract-card-title-row strong {
  font-size: 12px;
  color: #f4e8c9;
}

.contract-tier-badge {
  font-size: 10px;
  padding: 1px 5px;
  background: rgba(200, 153, 72, 0.12);
  color: var(--gold);
  border-radius: 2px;
}

.contract-card-desc {
  margin: 0 0 6px 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.guild-contract-card button {
  width: auto;
  white-space: nowrap;
  padding: 6px 12px;
  font-size: 11px;
}

/* Locked shop items: dimmed. Their lock and rank are drawn by
 * js/ui/town-progression.js (.town-lock, in town-progression.css), the same
 * as a locked town service. */
.shop-item.rank-locked {
  opacity: 0.6;
}

.shop-item.rank-locked button {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 1000px) {
  .guild-modal:not(.npc-service-modal) {
    width: min(540px, calc(var(--safe-vw) * .95)) !important;
  }
  .guild-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .guild-header-controls {
    justify-content: space-between;
  }
  .guild-modal-body, .guild-modal-body.has-active-contract {
    grid-template-columns: 1fr;
  }
  .guild-contracts-list {
    max-height: none;
  }
}
