/* =============================================
   SQUARE — Profile Page
============================================= */

/* ---- Profile Header ---- */
.profile-header {
  position: relative;
}
.profile-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.profile-avatar-wrap {
  position: absolute;
  bottom: -38px;
  left: 50%;
  transform: translateX(-50%);
}
.profile-avatar-ring {
  width: 84px; height: 84px;
  padding: 4px;
  border-radius: var(--r-full);
  background: var(--grad-story);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.profile-avatar-ring .avatar {
  width: 76px; height: 76px;
  border: 4px solid var(--bg);
  border-radius: var(--r-full);
  object-fit: cover;
  flex-shrink: 0;
}

/* ---- Profile Info ---- */
.profile-info {
  margin-top: 50px;
  padding: 0 var(--s-4) var(--s-4);
  text-align: center;
}
.profile-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}
.profile-name .verified-icon {
  width: 20px; height: 20px;
  color: var(--secondary);
  flex-shrink: 0;
}
.profile-username {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: var(--s-3);
}
.profile-bio {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto var(--s-3);
}
.profile-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  color: var(--text-2);
  font-size: 13px;
}
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.profile-meta-item svg {
  width: 14px; height: 14px;
  stroke-width: 2;
  flex-shrink: 0;
}
.profile-meta-item a {
  color: var(--secondary);
  font-weight: 500;
}

/* Profile interests (hashtags) */
.profile-interests {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--s-4);
}

/* ---- Stats ---- */
.profile-stats {
  display: flex;
  align-items: stretch;
  margin: 0 var(--s-4) var(--s-4);
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-4) var(--s-2);
  gap: 2px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.stat-item:hover { background: var(--surface-2); }
.stat-item + .stat-item {
  border-left: 1px solid var(--border);
}
.stat-number {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.stat-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Action buttons ---- */
.profile-actions {
  display: flex;
  gap: var(--s-2);
  padding: 0 var(--s-4) var(--s-4);
}
.profile-btn {
  flex: 1;
  padding: 10px var(--s-4);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  transition: all var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}
.profile-btn svg { width: 16px; height: 16px; stroke-width: 2.5; flex-shrink: 0; }
.profile-btn img.isax { width: 16px; height: 16px; flex-shrink: 0; }
.profile-btn.btn-primary img.isax { filter: invert(1); }
.profile-btn.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
  border: none;
}
.profile-btn.btn-primary:active { transform: scale(0.97); }
.profile-btn.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
}
.profile-btn.btn-outline:hover { background: var(--surface-2); }
.profile-btn.btn-icon {
  flex: 0 0 44px;
  width: 44px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-2);
}

/* ---- Tabs (Grid / List) ---- */
.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 0 var(--s-4);
}
.profile-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.profile-tab svg { width: 16px; height: 16px; stroke-width: 1.8; }
.profile-tab img.isax { width: 16px; height: 16px; }
.profile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---- Posts Grid ---- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: var(--s-1) 0;
}
.grid-post {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
}
.grid-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.grid-post:hover img { transform: scale(1.06); }
.grid-post .post-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
}
.grid-post:hover .post-overlay,
.grid-post:active .post-overlay { opacity: 1; }
.grid-post .post-overlay .likes {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.grid-post .post-overlay .likes svg {
  width: 18px; height: 18px;
  fill: #fff; stroke: #fff;
}

/* ---- List view ---- */
.posts-list { padding: var(--s-2) 0; }

.list-post {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  align-items: center;
}
.list-post:hover { background: var(--surface-2); }

.list-post-thumb {
  position: relative;
  flex-shrink: 0;
  width: 80px; height: 80px;
}
.list-post-thumb img {
  width: 80px; height: 80px;
  border-radius: var(--r-md);
  object-fit: cover;
  display: block;
}
.list-post-video-badge {
  position: absolute; bottom: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.5); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
}
.list-post-video-badge img.isax { width: 12px; height: 12px; filter: invert(1); }

.list-post-info {
  display: flex; flex-direction: column; justify-content: center;
  gap: 6px; flex: 1; min-width: 0;
}
.list-post-caption {
  font-size: 13px; color: var(--text); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.list-post-meta {
  display: flex; align-items: center; gap: var(--s-3);
}
.list-post-stat {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.list-post-stat img.isax {
  width: 14px; height: 14px;
  filter: brightness(0) saturate(100%) invert(32%) sepia(80%) saturate(2000%) hue-rotate(320deg) brightness(105%);
}
.list-post-stat:last-of-type img.isax { filter: none; opacity: 0.5; }
.list-post-time {
  font-size: 11px; color: var(--text-3);
  margin-left: auto;
}

/* Desktop: wider list layout */
@media (min-width: 900px) {
  .posts-list { padding: var(--s-3) 0; }
  .list-post { padding: var(--s-3) var(--s-6); gap: var(--s-4); }
  .list-post-thumb { width: 96px; height: 96px; }
  .list-post-thumb img { width: 96px; height: 96px; }
  .list-post-caption { font-size: 14px; }
}

/* ---- Profile top header ---- */
.profile-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-4);
}
.profile-top-header .back-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border-radius: var(--r-full);
}
.profile-top-header .back-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; }
.profile-top-header .settings-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  border-radius: var(--r-full);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.profile-top-header .settings-btn:hover { background: var(--surface-2); color: var(--text); }
.profile-top-header .settings-btn svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; }
