/* friends.css
 * Purpose: Styles for the friends page layout, including friend cards, grid layout, and responsive design.
 * This file encapsulates all visual styling for the friends section to keep the HTML markup clean.
 */

/* Page description styling for the friends page */
.friend-page .page-description {
  margin-top: 0.75rem;
  color: rgba(var(--color-neutral-500), 1);
  line-height: 1.8;
}

/* Promote the page headline with a larger size and bold color */
.friend-page .page-header h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  color: rgba(var(--color-neutral-900), 1);
}

/* Section container for friends and websites */
.friends-section {
  margin-top: 2.25rem;
}

/* Section headings */
.friends-section h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: rgba(var(--color-neutral-900), 1);
}

/* Grid layout for friend cards */
.friends-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Individual friend card styling */
.friend-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 1.25rem;
  background-color: rgba(var(--color-primary-50), 1);
  border: 1px solid rgba(var(--color-primary-200), 1);
  text-decoration: none;
  color: inherit;
  transition: var(--friend-card-transition);
  min-height: 220px;
  height: auto;
}

/* Hover and focus effects for friend cards */
.friend-card:hover,
.friend-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--friend-card-shadow-hover);
  border-color: rgba(var(--color-primary-300), 1);
  outline: 2px solid rgba(var(--color-primary-300), 0.3);
  outline-offset: 2px;
}

/* Avatar container styling */
.friend-avatar {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background-color: rgba(var(--color-secondary-200), 1);
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Avatar image styling */
.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback avatar text styling */
.friend-avatar span {
  font-size: 1.2rem;
  color: rgba(var(--color-neutral-600), 1);
}

/* Friend card body container */
.friend-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
}

/* Friend name heading */
.friend-body h3 {
  margin: 0;
  line-height: 1.2;
  min-height: 3rem;
  font-size: 1.1rem;
  color: rgba(var(--color-neutral-900), 1);
}

/* General paragraph styling in friend body */
.friend-body p {
  margin: 0;
  color: rgba(var(--color-neutral-600), 1);
  line-height: 1.6;
  position: relative;
}

/* Description text truncation to 2 lines with tooltip on hover */
.friend-body p:not(.friend-note) {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  cursor: help;
}

/* Friend note styling with ellipsis */
.friend-note {
  margin-top: 0.75rem;
  color: rgba(var(--color-neutral-500), 1);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: help;
}

/* CSS custom properties for consistent theming */
:root {
  --friend-card-transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  --friend-card-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  --friend-card-shadow-hover: 0 24px 48px rgba(15, 23, 42, 0.12);
}

/* Dark mode styling for friends page */
.dark .friend-page .page-description,
.dark .friends-section h2,
.dark .friend-body h3,
.dark .friend-body p,
.dark .friend-note,
.dark .friend-avatar span {
  transition: color 0.18s ease;
}

.dark .friend-page .page-description {
  color: rgba(var(--color-neutral-400), 1);
}

.dark .page-header h1 {
  color: rgba(var(--color-neutral-50), 1);
}

.dark .friends-section h2 {
  color: rgba(var(--color-neutral-100), 1);
}

.dark .friend-card {
  background-color: rgba(var(--color-primary-950), 1);
  border-color: rgba(var(--color-primary-700), 1);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.24);
}

.dark .friend-card:hover,
.dark .friend-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.32);
  border-color: rgba(var(--color-primary-600), 1);
}

.dark .friend-avatar {
  background-color: rgba(var(--color-secondary-800), 1);
}

.dark .friend-avatar span {
  color: rgba(var(--color-neutral-400), 1);
}

.dark .friend-body h3 {
  color: rgba(var(--color-neutral-50), 1);
}

.dark .friend-body p {
  color: rgba(var(--color-neutral-300), 1);
}

.dark .friend-note {
  color: rgba(var(--color-neutral-400), 1);
}

/* Responsive design for mobile devices */
@media (max-width: 680px) {
  .friend-card {
    height: auto;
  }
}
