/* css/lore.css — styling for the faction lore browser modal. */

.lore-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: lore-fade-in 120ms ease-out;
}
.lore-backdrop[hidden] { display: none !important; }

.lore-modal {
  position: relative;
  width: min(560px, 100%);
  max-height: 70vh;
  background: #1a1a1a;
  color: var(--text, #e0e0e0);
  border: 1px solid var(--lore-accent-dark, #3a3a3a);
  border-top: 3px solid var(--lore-accent, #c8c8c8);
  border-radius: 6px;
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(var(--lore-accent-rgb, 200, 200, 200), 0.10),
    inset 0 0 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lore-pop-in 140ms ease-out;
}

.lore-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  color: var(--text-muted, #a8a8a8);
  border: none;
  font-size: 22px;
  line-height: 1;
  width: 28px;
  height: 28px;
  cursor: pointer;
  padding: 0;
  border-radius: 4px;
}
.lore-close:hover {
  color: var(--lore-accent, #fff);
  background: rgba(255, 255, 255, 0.05);
}

.lore-body {
  padding: 28px 30px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 15px;
  line-height: 1.65;
}

.lore-header {
  margin-bottom: 14px;
}

.lore-faction-name {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--lore-accent, #e8e8e8);
  margin-bottom: 4px;
}

.lore-tagline {
  font-style: italic;
  font-variant: small-caps;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--text-muted, #a8a8a8);
  margin-bottom: 10px;
}

.lore-divider {
  height: 2px;
  width: 60px;
  background: linear-gradient(
    90deg,
    var(--lore-accent, #c8c8c8),
    transparent
  );
  margin-top: 6px;
  margin-bottom: 4px;
}

.lore-paragraph {
  margin: 0;
  text-align: justify;
  hyphens: auto;
  color: var(--text, #e0e0e0);
}

.lore-paragraph.lore-missing {
  font-style: italic;
  color: var(--text-muted, #888);
  text-align: left;
}

.lore-footer {
  border-top: 1px solid var(--border, #3a3a3a);
  padding: 10px 16px;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}

.lore-btn {
  background: transparent;
  color: var(--text, #e0e0e0);
  border: 1px solid var(--lore-accent-dark, #5a5a5a);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
.lore-btn:hover {
  background: rgba(var(--lore-accent-rgb, 200, 200, 200), 0.12);
  color: var(--lore-accent, #fff);
}

/* Browse-all grid shown when user clicks "Browse all". */
.lore-browse {
  border-top: 1px solid var(--border, #3a3a3a);
  padding: 14px 22px 6px;
  max-height: 40vh;
  overflow-y: auto;
  flex: 0 1 auto;
  background: rgba(0, 0, 0, 0.18);
}
.lore-browse[hidden] { display: none; }

.lore-browse-title {
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 13px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--text-muted, #a8a8a8);
  margin-bottom: 8px;
}

.lore-browse-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.lore-browse-item {
  text-align: left;
  background: transparent;
  color: var(--text, #d6d6d6);
  border: none;
  border-left: 2px solid transparent;
  padding: 4px 8px;
  font-size: 13px;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  cursor: pointer;
  border-radius: 0;
}
.lore-browse-item:hover {
  background: rgba(var(--lore-accent-rgb, 200, 200, 200), 0.10);
  border-left-color: var(--lore-accent, #c8c8c8);
  color: var(--lore-accent, #fff);
}

/* Make the clickable faction chip in the detail panel feel interactive. */
.lore-detail-hook .detail-faction {
  cursor: pointer;
  border-bottom: 1px dotted rgba(var(--accent-rgb, 200, 200, 200), 0.45);
  transition: color 120ms ease;
}
.lore-detail-hook .detail-faction:hover {
  color: var(--accent, #fff);
  border-bottom-style: solid;
}

/* Don't let background scroll while modal is open. */
body.lore-modal-open { overflow: hidden; }

/* Scrollbar polish for dark theme. */
.lore-body::-webkit-scrollbar,
.lore-browse::-webkit-scrollbar {
  width: 8px;
}
.lore-body::-webkit-scrollbar-thumb,
.lore-browse::-webkit-scrollbar-thumb {
  background: rgba(var(--lore-accent-rgb, 200, 200, 200), 0.25);
  border-radius: 4px;
}

@keyframes lore-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lore-pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .lore-backdrop,
  .lore-modal {
    animation: none !important;
  }
}

@media (max-width: 520px) {
  .lore-body { padding: 22px 20px 14px; font-size: 14.5px; }
  .lore-browse-grid { grid-template-columns: 1fr; }
  .lore-faction-name { font-size: 19px; }
}
