/* Player Hub - Traditional Forum styles */

/* ============================================
   Hub navigation tabs (rendered inside top bar)
   ============================================ */

.hub-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  min-width: 0;

  /* Offset the top-bar bottom border so active tab indicator overlaps it */
  margin-bottom: calc(-1 * var(--space-sm) - 2px);
  padding-bottom: 0;
}

.hub-nav-campaign {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  margin-right: var(--space-sm);
  padding-right: var(--space-md);
  border-right: 1px solid var(--parchment-dark);
  white-space: nowrap;
  text-decoration: none;
}

a.hub-nav-campaign:hover {
  opacity: 0.8;
}

.hub-nav-dm-badge {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--parchment-light);
  background: var(--warm-grey);
  padding: var(--padding-badge);
  border-radius: var(--radius-sm);
}

.hub-nav-tab {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--warm-grey-light);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.hub-nav-tab:hover {
  color: var(--warm-grey-dark);
  background-color: var(--parchment-light);
}

.hub-nav-tab--active {
  color: var(--warm-grey-dark);
  font-weight: 600;
  background-color: var(--parchment-light);
  border-color: var(--parchment-dark);
  box-shadow: 0 -1px 2px rgba(74, 69, 64, 0.08);

  /* Extend 2px past the top-bar border to fully cover it */
  margin-bottom: -2px;
  padding-bottom: calc(var(--space-sm) + 2px);
  border-bottom-color: var(--parchment-light);
}

/* ============================================
   Shared avatar
   ============================================ */

.hub-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--parchment-dark);
}

.hub-avatar--sm {
  width: 32px;
  height: 32px;
}

.hub-avatar--lg {
  width: 80px;
  height: 80px;
}

/* ============================================
   Hub page header (shared across all hub pages)
   ============================================ */

.hub-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.hub-page-header h1 {
  margin: 0;
}

.hub-page-subtitle {
  margin: var(--space-xs) 0 0;
  font-size: 0.9rem;
  color: var(--warm-grey-light);
}

/* Thread list — table-like forum layout */
.hub-thread-list {
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.hub-thread-list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 120px;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--parchment-dark);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warm-grey);
}

.hub-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 120px;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--parchment-base);
  text-decoration: none;
  color: var(--warm-grey-dark);
  transition: background-color 0.15s ease;
}

.hub-thread-row + .hub-thread-row {
  border-top: 1px solid var(--parchment-dark);
}

.hub-thread-row:hover {
  background: var(--parchment-light);
}

.hub-thread-main {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.hub-thread-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hub-thread-icon-svg {
  width: 20px;
  height: 20px;
  opacity: 0.5;
}

.hub-thread-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.hub-thread-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-thread-meta {
  font-size: 0.8rem;
  color: var(--warm-grey-light);
}

.hub-thread-meta strong {
  color: var(--warm-grey);
}

.hub-thread-stats {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--warm-grey);
}

.hub-thread-last-post {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.8rem;
  color: var(--warm-grey-light);
}

/* ============================================
   Empty state
   ============================================ */

.hub-empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--warm-grey-light);
  font-style: italic;
}

/* ============================================
   Forum post layout (comments + OP)
   ============================================ */

.hub-post {
  display: flex;
  gap: var(--space-md);
  background: var(--parchment-base);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.hub-post + .hub-post {
  margin-top: var(--space-2xs);
}

.hub-post-sidebar {
  flex-shrink: 0;
  width: 120px;
  padding: var(--space-md) var(--space-sm);
  background: color-mix(in srgb, var(--parchment-dark) 30%, var(--parchment-base));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-align: center;
}

.hub-post-author {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--warm-grey-dark);
  overflow-wrap: break-word;
}

.hub-post-author--dm {
  color: var(--campaign-primary-color, #7f1d1d);
}

.hub-post-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--parchment-light);
  background: var(--campaign-primary-color, var(--warm-grey));
  padding: var(--padding-badge);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.hub-post-body {
  flex: 1;
  min-width: 0;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
}

.hub-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--parchment-dark);
  font-size: 0.8rem;
  color: var(--warm-grey-light);
}

.hub-post-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hub-post-content {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.6;
}

.hub-post-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--warm-grey-light);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  font-family: inherit;
}

.hub-post-delete:hover {
  color: var(--color-error);
}


/* ============================================
   Linked note blockquote (discussion show)
   ============================================ */

.hub-linked-note {
  margin-bottom: var(--space-md);
}

.hub-linked-note-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  font-size: 0.85rem;
}

.hub-linked-note-author {
  font-weight: 600;
  color: var(--warm-grey-dark);
}

.hub-linked-note-meta {
  color: var(--warm-grey-light);
}

.hub-linked-note-content {
  margin: 0;
  padding: var(--space-md) var(--space-md) var(--space-sm) var(--space-xl);
  border-left: 3px solid var(--parchment-dark);
  background: var(--parchment-base);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  line-height: 1.6;
  position: relative;
}

.hub-linked-note-content::before {
  content: '\201C';
  position: absolute;
  top: -0.05em;
  left: 0.05em;
  font-size: 10rem;
  line-height: 1;
  color: var(--parchment-dark);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.expandable-text-enabled .hub-linked-note-content.hub-note-content--truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3em;
  background: linear-gradient(to bottom, transparent, var(--parchment-base));
  pointer-events: none;
  z-index: 1;
}

/* ============================================
   Thread list prefix (e.g. "Note:")
   ============================================ */

.hub-thread-prefix {
  color: var(--warm-grey-light);
  font-weight: 400;
}

/* ============================================
   Thread pages (discussion, session, note)
   ============================================ */

.hub-thread {
  max-width: 850px;
  margin: 0 auto;
}

.hub-section {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.hub-section-title {
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--parchment-dark);
}

/* Post timeline */
.hub-post-timeline {
  display: flex;
  flex-direction: column;
}

/* ============================================
   Links and buttons
   ============================================ */

.hub-link {
  font-size: 0.85rem;
  color: var(--warm-grey-light);
  text-decoration: none;
}

.hub-link:hover {
  color: var(--warm-grey-dark);
  text-decoration: underline;
}

/* ============================================
   Comment form
   ============================================ */

.hub-comment-form {
  margin-top: var(--space-md);
}

.hub-comment-form-actions {
  margin-top: var(--space-sm);
  display: flex;
  justify-content: flex-end;
}

/* ============================================
   Note article layout (session notes)
   ============================================ */

.hub-filter {
  margin-bottom: var(--space-md);
}

.hub-note {
  background: var(--parchment-base);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  margin-top: var(--space-lg);
}

.hub-note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--parchment-dark);
}

.hub-note-author {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 0;
}

.hub-note-author a {
  color: var(--warm-grey-dark);
  text-decoration: none;
}

.hub-note-author a:hover {
  text-decoration: underline;
}

.hub-note-title-sep {
  color: var(--warm-grey-light);
  font-weight: 400;
}

.hub-note-title {
  font-weight: 400;
  color: var(--warm-grey);
}

.hub-note-meta {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--warm-grey-light);
}

.hub-note-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.hub-note-content {
  padding: var(--space-md);
  font-size: 0.9rem;
  line-height: 1.7;
  background: var(--parchment-light);
}

.hub-note-content--truncated {
  max-height: 8em;
  overflow: hidden;
}

.hub-note-preview {
  position: relative;
}

.expandable-text-enabled .hub-note-preview {
  cursor: pointer;
}

.expandable-text-enabled .hub-note-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3em;
  background: linear-gradient(to bottom, transparent, var(--parchment-light));
  pointer-events: none;
  z-index: 1;
}

.hub-post .expandable-text-enabled .hub-note-preview::after {
  background: linear-gradient(to bottom, transparent, var(--parchment-base));
}


.hub-note-read-more {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--parchment-light);
  border: none;
  color: var(--warm-grey);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  cursor: pointer;
  padding: var(--space-xs) 0 var(--space-sm);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.hub-note-read-more:hover {
  color: var(--warm-grey-dark);
}

.hub-post .hub-note-read-more,
.hub-linked-note .hub-note-read-more {
  background: var(--parchment-base);
}

.hub-linked-note .hub-note-read-more {
  border-left: 3px solid var(--parchment-dark);
  border-radius: 0 0 var(--radius-sm) 0;
}

.hub-note-empty {
  text-align: center;
  padding: var(--space-md);
  color: var(--warm-grey-light);
  font-style: italic;
}

.hub-note-empty p {
  margin: 0 0 var(--space-sm);
}

.hub-note-edit-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  justify-content: flex-end;
  padding: var(--space-sm) 0 0;
}

/* ============================================
   Party roster
   ============================================ */

.hub-party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.hub-party-card {
  display: flex;
  flex-direction: column;
  min-height: 140px;
  background: var(--parchment-base);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  color: var(--warm-grey-dark);
}

.hub-party-card-link {
  display: flex;
  flex: 1;
  gap: var(--space-md);
  padding: var(--space-md);
  text-decoration: none;
  color: inherit;
  transition: background-color 0.15s ease;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.hub-party-card-link:hover {
  background: var(--parchment-light);
}

/* When no companions, round all corners on hover */
.hub-party-card-link:last-child {
  border-radius: var(--radius-sm);
}

.hub-party-card-avatar {
  flex-shrink: 0;
}

.hub-party-card-info {
  min-width: 0;
}

.hub-party-card-name {
  margin: 0 0 var(--space-xs);
  font-size: 1.1rem;
}

.hub-party-card-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--warm-grey);
  line-height: 1.5;
}

/* ============================================
   Party companion rows (nested under PC cards)
   ============================================ */

.hub-party-companions {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-top: 1px solid var(--parchment-dark);
}

.hub-party-companion {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  padding-left: calc(var(--space-md) + var(--space-lg));
  text-decoration: none;
  color: var(--warm-grey-dark);
  font-size: 0.9rem;
  transition: background-color 0.15s ease;
}

.hub-party-companion:hover {
  background: var(--parchment-light);
}

.hub-party-companion-icon {
  flex-shrink: 0;
}

.hub-party-companion-name {
  font-weight: 500;
}

/* ============================================
   Companion cards (player profile & my character)
   ============================================ */

.hub-companion-card {
  background: var(--parchment-base);
  border: 1px solid var(--parchment-dark);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

.hub-companion-card + .hub-companion-card {
  margin-top: var(--space-md);
}

.hub-companion-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.hub-companion-card-name {
  margin: 0;
  font-size: 1rem;
}

.hub-companion-card-name a {
  color: var(--warm-grey-dark);
  text-decoration: none;
}

.hub-companion-card-name a:hover {
  text-decoration: underline;
}

.hub-companion-parent {
  margin: calc(-1 * var(--space-sm)) 0 var(--space-md);
  font-size: 0.9rem;
  color: var(--warm-grey);
}

/* ============================================
   Hub settings
   ============================================ */

.hub-settings-form {
  max-width: 480px;
}

.hub-settings-avatar-section {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.hub-settings-avatar-preview {
  flex-shrink: 0;
}

.hub-settings-hint {
  margin: var(--space-xs) 0 0;
  font-size: 0.8rem;
  color: var(--warm-grey-light);
}

/* ============================================
   Mobile adjustments
   ============================================ */

@media (max-width: 480px) {
  .hub-thread-list-header {
    display: none;
  }

  .hub-thread-row {
    display: flex;
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .hub-thread-icon {
    display: none;
  }

  .hub-thread-stats,
  .hub-thread-last-post {
    display: none;
  }

  .hub-thread-main {
    flex: 1;
  }

  /* Posts collapse to stacked layout */
  .hub-post {
    flex-direction: column;
  }

  .hub-post-sidebar {
    width: auto;
    flex-direction: row;
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  .hub-post-sidebar .hub-avatar--lg {
    width: 32px;
    height: 32px;
  }
}
