/* ===============================================
   PORTERS.CSS - Porters Page Styles
   Porter Cards, Modals, and Badges
   =============================================== */

/* Counter styling is inherited from games-filters.css (portsCounter) */

/* ===== Porter card =====
   Unlike .pm-card on the Browse grid, porters keep a boxed card (the
   avatar alone doesn't fill a tile the way a screenshot does, so a flat
   cardless tile read as too sparse) - .porter-card still reuses
   .game-grid for layout (see porters.md) so column counts/gaps always
   match Browse exactly. Stats stay a distinct .porter-stat class (not
   .card-stat) because shared-cards.css hides .card-stat:last-child
   sitewide to drop the date column on port cards, which would silently
   eat the downloads figure here too. */
.porter-card {
  position: relative;
  min-width: 0;
  padding: 1.25rem 1rem;
  border-radius: 12px;
  box-shadow: var(--md-shadow-z1);
  background-color: var(--card-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.porter-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.25), 0 0 15px rgba(255, 255, 255, 0.1);
  background-color: var(--card-bg-hover);
}

.porter-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}

.porter-avatar img,
.porter-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.porter-avatar img {
  object-fit: cover;
  display: block;
}

.porter-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #F49519, #ff6b35);
}

.porter-card h3 {
  margin: 0 0 0.3rem;
  width: 100%;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--card-text, var(--md-default-fg-color));
}

.porter-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.68rem;
  color: var(--card-stat-color, var(--md-default-fg-color--light));
}

.porter-stat {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.porter-stat i {
  color: #F49519;
  font-size: 0.72rem;
}

.porter-support-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ===== Porter detail header (/porter/?name=X) =====
   Flat, unboxed - no gradient panel/border-radius/card background. Same
   "content sits directly on the page" treatment as the rest of the site
   post-redesign (hero, showcase text, stats-cards-grid all dropped their
   boxes too), rather than a standalone card competing with the page. */
.porter-detail-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0 0;
}

.porter-detail-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #F49519, #ff6b35);
  flex-shrink: 0;
  color: #fff;
  font-size: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.porter-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.porter-detail-info {
  flex: 1;
}

.porter-detail-info h1 {
  margin: 0 0 0.5rem 0;
  color: var(--md-default-fg-color);
  font-size: 2rem;
}

.porter-detail-bio {
  margin: 0 0 1rem 0;
  color: var(--md-default-fg-color--light);
}

.porter-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.no-links {
  color: var(--md-default-fg-color--light);
  font-size: 0.9rem;
}

/* Reuses .stats-card/.stats-card-icon/.stats-card-value/.stats-card-label
   from homepage.css for the individual stat items (icon, big number,
   uppercase label - no boxes), same component as the homepage's stats
   row. Just 2 items here rather than 4, and no border - flat like the
   rest of the page now. */
.porter-detail-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1.5rem 0;
}

.no-ports {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--md-default-fg-color--light);
  padding: 2rem;
}

/* Porter link badge in game modal */
.porter-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  margin: 0.1rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

[data-md-color-scheme="light"] .porter-link-badge {
  background-color: #e8e8e8;
  color: #333333;
}

[data-md-color-scheme="dark"] .porter-link-badge {
  background-color: #333333;
  color: #eeeeee;
}

[data-md-color-scheme="light"] .porter-link-badge:hover {
  background-color: #F49519;
  color: #333333;
}

[data-md-color-scheme="dark"] .porter-link-badge:hover {
  background-color: #F49519;
  color: #eeeeee;
}

.porter-link-badge i {
  font-size: 0.6rem;
}

/* Prevent glightbox on images */
img.no-lightbox {
  pointer-events: none !important;
}

.porter-avatar img,
.porter-detail-avatar img,
.porter-game-card img,
.game-card img {
  pointer-events: none !important;
}

/* Responsive porter detail header */
@media (max-width: 600px) {
  .porter-detail-header {
    flex-direction: column;
    text-align: center;
    padding-top: 0.5rem;
  }

  .porter-detail-avatar {
    width: 100px;
    height: 100px;
    font-size: 3rem;
  }

  .porter-detail-info h1 {
    font-size: 1.5rem;
  }

  .porter-detail-links {
    justify-content: center;
  }

  .porter-detail-stats {
    gap: 2rem;
  }
}
/* ===== Fix card sizing without mobile freeze ===== */

/* Desktop only: allow intrinsic size hint */
@media (min-width: 769px) {
  .game-card {
    content-visibility: auto;
    contain: layout style paint;
    contain-intrinsic-size: 0 280px;
  }
}

@media (max-width: 768px) {
  .game-card {
    content-visibility: visible;   /* disables freeze */
    contain: layout;               /* keeps grid sizing stable */
    contain-intrinsic-size: auto;  /* no fake height */
  }
}

/* ===== Moved from games.css: page header + search bar (was misfiled
   there - this is entirely porters.md-specific). ===== */
.porters-header {
  text-align: center;
  padding: 2rem 1rem;
  margin-bottom: 1rem;
}

.porters-header h1 {
  color: #F49519;
  margin: 0 0 0.5rem 0;
  font-size: 2.5rem;
}

.porters-subtitle {
  color: var(--md-default-fg-color--light);
  margin: 0 0 1.5rem 0;
  font-size: 1.1rem;
}

.porters-search-wrapper {
  max-width: 400px;
  margin: 0 auto 1rem;
}

.porters-search {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--md-default-fg-color--lightest);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  transition: border-color 0.2s ease;
}

.porters-search:focus {
  outline: none;
  border-color: #F49519;
}

/* Porter detail page (/porter/?name=X): "Ports by this Porter" heading
   left, grid/list toggle right - same row, matching the Browse page's
   toolbar. .view-toggle-wrapper has no width of its own (it's meant to
   be sized by a flex parent), so without this it falls back to block
   layout and stretches full-width instead of sitting compactly right. */
.porter-ports-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 1rem;
}

.porter-ports-heading {
  margin: 0;
}

