/* ================================================================
   PORTFOLIO — DESIGN SYSTEM & STYLES
   Dark glassmorphism theme, Instagram-inspired layout
   ================================================================ */

/* ── Google Fonts loaded via <link> in HTML ───────────────────── */

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Background layers */
  --bg:        #08080f;
  --bg-2:      #0d0d1a;
  --bg-3:      #131320;

  /* Glass surfaces */
  --surface:   rgba(255,255,255,0.035);
  --surface-2: rgba(255,255,255,0.065);
  --surface-3: rgba(255,255,255,0.10);

  /* Borders */
  --border:    rgba(255,255,255,0.07);
  --border-2:  rgba(255,255,255,0.12);
  --border-3:  rgba(255,255,255,0.22);

  /* Brand gradient — Instagram-inspired */
  --grad:      linear-gradient(135deg, #833ab4 0%, #c13584 35%, #fd1d1d 65%, #fcb045 100%);
  --grad-text: linear-gradient(135deg, #b06de8 0%, #e0608e 40%, #ff6b35 100%);
  --grad-card: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.45) 45%, transparent 85%);
  --accent:    #c13584;
  --accent-glow: rgba(193,53,132,0.28);

  /* Text */
  --text:   #f4f4ff;
  --text-2: rgba(244,244,255,0.60);
  --text-3: rgba(244,244,255,0.36);

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

  /* Layout */
  --gap:         12px;
  --gap-lg:      24px;
  --gutter:      16px;
  --max-w:       935px;

  /* Shape */
  --r:           12px;
  --r-lg:        20px;
  --r-xl:        28px;
  --r-full:      9999px;

  /* Shadows */
  --shadow-sm:   0 2px 8px rgba(0,0,0,.35);
  --shadow:      0 4px 24px rgba(0,0,0,.55);
  --shadow-lg:   0 12px 48px rgba(0,0,0,.75);
  --shadow-glow: 0 0 32px var(--accent-glow);

  /* Motion */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.17, 0.89, 0.32, 1.49);
  --dur:         0.22s;
  --dur-md:      0.30s;
  --dur-lg:      0.40s;

  /* Profile */
  --avatar-size: 150px;

  /* Z-layers */
  --z-nav:    50;
  --z-btt:    100;
  --z-lb:     200;
  --z-popup:  300;
  --z-loader: 999;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
}
img, video { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ── App Loader ──────────────────────────────────────────────── */
.app-loader {
  position: fixed;
  inset: 0;
  z-index: var(--z-loader);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease), visibility 0.5s var(--ease);
}
.app-loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.loader-logo {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--grad);
  animation: loaderPulse 1.6s var(--ease) infinite;
}
.loader-bar {
  width: 160px;
  height: 3px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.loader-progress {
  height: 100%;
  background: var(--grad);
  border-radius: var(--r-full);
  animation: loaderSlide 1.4s var(--ease) infinite;
}
.loader-text {
  font-size: 0.78rem;
  color: var(--text-3);
  letter-spacing: 0.06em;
  font-weight: 500;
}

@keyframes loaderPulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:0.75; transform:scale(0.93); }
}
@keyframes loaderSlide {
  0%   { width:0%;   margin-left:0%; }
  55%  { width:85%;  margin-left:0%; }
  100% { width:0%;   margin-left:100%; }
}

/* ── Profile Section ─────────────────────────────────────────── */
.profile {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px var(--gutter) 36px;
}
.profile-container {
  display: flex;
  gap: 56px;
  align-items: flex-start;
}

/* Avatar */
.profile-avatar-wrap { flex-shrink: 0; }
.avatar-ring {
  width: calc(var(--avatar-size) + 8px);
  height: calc(var(--avatar-size) + 8px);
  border-radius: 50%;
  padding: 3px;
  background: var(--grad);
  animation: avatarGlow 4s var(--ease) infinite alternate;
}
@keyframes avatarGlow {
  from { box-shadow: 0 0 18px rgba(193,53,132,.28), 0 0 36px rgba(131,58,180,.15); }
  to   { box-shadow: 0 0 36px rgba(131,58,180,.45), 0 0 60px rgba(193,53,132,.25); }
}
.profile-avatar {
  width:  var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  background: var(--bg-3);
  display: block;
  transition: transform var(--dur-md) var(--ease);
}
.avatar-ring:hover .profile-avatar { transform: scale(1.04); }

/* Info block */
.profile-info { flex: 1; min-width: 0; }

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.profile-name {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.profile-tagline {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.profile-bio {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.7;
}
.profile-bio p + p { margin-top: 3px; }

/* Stats */
.profile-stats {
  display: flex;
  gap: 40px;
  margin-bottom: 16px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.stat-label {
  font-size: 0.76rem;
  color: var(--text-2);
}

/* Buttons */
.profile-actions { display: flex; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background var(--dur) var(--ease);
}
.btn:hover::after { background: rgba(255,255,255,0.09); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-3);
  transform: translateY(-1px);
}

/* ── Category Nav ────────────────────────────────────────────── */
.categories-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: rgba(8,8,15,0.82);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur) var(--ease);
}
.categories-nav.scrolled { box-shadow: 0 2px 24px rgba(0,0,0,.6); }

.categories-scroll {
  display: flex;
  gap: 6px;
  padding: 10px var(--gutter);
  max-width: calc(var(--max-w) + var(--gutter) * 2);
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.category-tab {
  padding: 7px 20px;
  border-radius: var(--r-full);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.category-tab:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border-2);
}
.category-tab.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 2px 18px var(--accent-glow);
}

/* ── Gallery Layout ──────────────────────────────────────────── */
.gallery-main {
  max-width: calc(var(--max-w) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 20px var(--gutter) 40px;
}

/* ── Masonry Grid ────────────────────────────────────────────── */
.masonry-grid {
  columns: 3 240px;
  column-gap: var(--gap);
}

/* ── Card ────────────────────────────────────────────────────── */
.card {
  break-inside: avoid;
  page-break-inside: avoid;
  position: relative;
  margin-bottom: var(--gap);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-3);
  border: 1px solid var(--border);
  transition:
    transform   var(--dur-md) var(--ease),
    box-shadow  var(--dur-md) var(--ease),
    border-color var(--dur)   var(--ease);
  will-change: transform;
  animation: cardReveal 0.45s var(--ease) both;
  -webkit-tap-highlight-color: transparent;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.card:hover {
  transform: scale(1.016) translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-2);
  border-color: var(--border-2);
  z-index: 3;
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Card media */
.card-media {
  width: 100%;
  height: auto;
  display: block;
  min-height: 80px;
  background: var(--bg-3);
  transition: transform 0.55s var(--ease);
  /* blur-up transition */
  will-change: transform;
}
.card:hover .card-media { transform: scale(1.045); }

.card-media.loading {
  filter: blur(10px);
  transition: filter 0.5s ease, transform 0.55s var(--ease);
}
.card-media.loaded { filter: none; }

/* Video badge */
.card-video-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-full);
  padding: 4px 10px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  z-index: 2;
  pointer-events: none;
}

/* Play button overlay for videos */
.card-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0,0,0,.50);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,.30);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  transition: all var(--dur) var(--ease);
  z-index: 2;
  pointer-events: none;
}
.card:hover .card-play-btn {
  background: rgba(0,0,0,.70);
  transform: translate(-50%,-50%) scale(1.1);
  border-color: rgba(255,255,255,.5);
}

/* Hover overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  background: var(--grad-card);
  opacity: 0;
  transition: opacity var(--dur-md) var(--ease);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  border-radius: var(--r);
  pointer-events: none;
}
.card:hover .card-overlay {
  opacity: 1;
  pointer-events: auto;
}
.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
  margin-bottom: 2px;
}
.card-cat {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.65);
  margin-bottom: 9px;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* Card like button */
.card-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: var(--r-full);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #fff;
  transition: all 0.15s var(--ease);
  align-self: flex-start;
  z-index: 3;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.card-like-btn:hover {
  background: rgba(255,255,255,0.22);
  transform: scale(1.06);
}
.card-like-btn:active { transform: scale(0.97); }

.card-like-btn .lbheart { transition: fill var(--dur) var(--ease), stroke var(--dur) var(--ease); }
.card-like-btn.liked .lbheart {
  fill: #ff4d6d;
  stroke: #ff4d6d;
  animation: heartPop 0.38s var(--ease-spring);
}

/* ── Skeleton Shimmer ────────────────────────────────────────── */
.card-skeleton {
  min-height: 200px;
  background: linear-gradient(90deg,
    var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.7s ease infinite;
}
@keyframes shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Infinite Scroll Sentinel ────────────────────────────────── */
.sentinel { height: 100px; width: 100%; pointer-events: none; }

/* Loading Spinner */
.loading-indicator {
  display: flex;
  justify-content: center;
  padding: 24px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.loading-indicator.active { opacity: 1; }

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 100px var(--gutter) 80px;
}
.empty-icon { font-size: 3.5rem; margin-bottom: 18px; opacity: 0.65; }
.empty-title { font-size: 1.2rem; color: var(--text-2); margin-bottom: 10px; }
.empty-subtitle {
  font-size: 0.875rem;
  color: var(--text-3);
  line-height: 1.7;
  max-width: 420px;
  margin: 0 auto;
}
.empty-subtitle code {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
}

/* ── Lightbox ────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lb);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,12,0.97);
  backdrop-filter: blur(32px) saturate(130%);
  -webkit-backdrop-filter: blur(32px) saturate(130%);
  animation: lbIn 0.22s var(--ease);
}
.lightbox[hidden] { display: none !important; }

@keyframes lbIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Lightbox – close */
.lightbox-close {
  position: fixed;
  top: 18px; right: 18px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.13);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
}
.lightbox-close:hover {
  background: rgba(255,255,255,.18);
  transform: scale(1.07);
}

/* Lightbox – counter */
.lightbox-counter {
  position: fixed;
  top: 22px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-2);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 5px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  z-index: 5;
  white-space: nowrap;
  pointer-events: none;
}

/* Lightbox – media */
.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(94vw, 1280px);
  max-height: calc(100svh - 140px);
  animation: lbContentIn 0.3s var(--ease);
  position: relative;
}
@keyframes lbContentIn {
  from { opacity:0; transform:scale(0.94); }
  to   { opacity:1; transform:scale(1); }
}
.lightbox-content img {
  max-width:  min(94vw, 1280px);
  max-height: calc(100svh - 140px);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
}
.lightbox-content video {
  max-width:  min(94vw, 1280px);
  max-height: calc(100svh - 140px);
  width: auto; height: auto;
  border-radius: var(--r);
  outline: none;
  box-shadow: var(--shadow-lg);
}

/* Lightbox – nav arrows */
.lightbox-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.13);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-nav:hover {
  background: rgba(255,255,255,.20);
  transform: translateY(-50%) scale(1.07);
}
.lightbox-nav:disabled { opacity: 0.18; pointer-events: none; }
.lightbox-nav.prev { left: 18px; }
.lightbox-nav.next { right: 18px; }

/* Lightbox – info bar */
.lightbox-info {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 20px 24px;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 5;
}
.lightbox-meta { min-width: 0; }
.lightbox-title {
  font-size: 1rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lightbox-category {
  display: block;
  font-size: 0.77rem; color: var(--text-2); margin-top: 3px;
}

/* Lightbox – like button */
.lightbox-like-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-full);
  padding: 9px 18px;
  font-size: 0.9rem; font-weight: 500;
  color: #fff;
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}
.lightbox-like-btn:hover {
  background: rgba(255,255,255,.20);
  transform: scale(1.04);
}
.lightbox-like-btn:active { transform: scale(0.97); }

.heart-svg { transition: fill var(--dur) var(--ease), stroke var(--dur) var(--ease); }
.lightbox-like-btn.liked {
  background: rgba(255,77,109,.18);
  border-color: rgba(255,77,109,.38);
}
.lightbox-like-btn.liked .heart-svg {
  fill: #ff4d6d;
  stroke: #ff4d6d;
  animation: heartPop 0.38s var(--ease-spring);
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes heartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  70%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}

/* ── Message Popup ───────────────────────────────────────────── */
.message-popup {
  position: fixed;
  inset: 0;
  z-index: var(--z-popup);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.message-popup[hidden] { display: none !important; }

.popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.68);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  animation: bdFadeIn var(--dur) var(--ease);
}
@keyframes bdFadeIn { from{opacity:0} to{opacity:1} }

.popup-panel {
  position: relative;
  width: 100%;
  max-width: 530px;
  background: rgba(14,14,22,0.97);
  border: 1px solid var(--border-2);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0 22px 36px;
  box-shadow: 0 -12px 48px rgba(0,0,0,.6);
  animation: panelUp var(--dur-lg) var(--ease-out);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@keyframes panelUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.popup-handle {
  width: 40px; height: 4px;
  background: var(--border-3);
  border-radius: var(--r-full);
  margin: 14px auto 22px;
}
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.popup-title { font-size: 1.1rem; font-weight: 700; }
.popup-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur) var(--ease);
}
.popup-close:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: scale(1.06);
}

.popup-contacts { display: flex; flex-direction: column; gap: 10px; }

.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.contact-link:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateX(5px);
}
.contact-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-icon.ig { background: var(--grad); }
.contact-icon.li { background: #0077b5; }
.contact-icon.up { background: #14a800; }
.contact-icon.em { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

.contact-info { flex: 1; min-width: 0; }
.contact-label { display: block; font-size: 0.9rem; font-weight: 600; }
.contact-handle {
  display: block;
  font-size: 0.78rem; color: var(--text-2); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-arrow {
  color: var(--text-3);
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease);
  display: flex; align-items: center;
}
.contact-link:hover .contact-arrow { transform: translateX(5px); }

/* ── Back to Top ─────────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 26px; right: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all var(--dur-md) var(--ease);
  z-index: var(--z-btt);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--surface-3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --avatar-size: 90px; }
  .profile { padding: 24px var(--gutter) 20px; }
  .profile-container { gap: 18px; }
  .profile-stats { gap: 22px; }
  .masonry-grid { columns: 2 150px; }
  .gallery-main { padding: 12px 8px 32px; }
  .lightbox-nav { width: 38px; height: 38px; }
  .lightbox-nav.prev { left: 10px; }
  .lightbox-nav.next { right: 10px; }
  .lightbox-info { padding: 14px 16px; }
  .back-to-top { bottom: 16px; right: 16px; }
}

@media (max-width: 480px) {
  .profile-container { flex-direction: column; gap: 14px; }
  .profile-name { font-size: 1.3rem; }
  .masonry-grid { columns: 2 110px; column-gap: 8px; }
  .masonry-grid .card { margin-bottom: 8px; }
  .btn { padding: 8px 16px; font-size: 0.82rem; }
}

@media (min-width: 1200px) {
  .masonry-grid { columns: 4 200px; }
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
