/* PeekGram - Premium Anonymous Instagram Viewer */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --ig-pink: #E1306C;
  --ig-purple: #833AB4;
  --ig-orange: #F77737;
  --ig-yellow: #FCAF45;
  --ig-gradient: linear-gradient(135deg, #833AB4, #E1306C, #F77737);
  --ig-gradient-h: linear-gradient(90deg, #833AB4, #E1306C, #F77737, #FCAF45);

  /* Deep navy base — not pure black */
  --bg-primary: #0c0c16;
  --bg-secondary: #11111f;
  --bg-card: #181828;
  --bg-elevated: #20203a;
  --bg-card-hover: #20203a;
  --bg-input: #181828;

  /* Glass-style borders */
  --border: rgba(255,255,255,0.09);
  --border-light: rgba(255,255,255,0.18);

  --text-primary: #f0f0f8;
  --text-secondary: #9090b0;
  --text-muted: #52527a;

  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 8px;

  --shadow-glow: 0 0 80px rgba(131,58,180,0.25);
  --shadow-card: 0 8px 50px rgba(0,0,0,0.5);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 18px; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
/* Fixed-position gradient overlay — always covers full viewport on all devices (incl. iOS) */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 180% 85% at 50% -15%, rgba(131,58,180,0.40) 0%, transparent 68%),
    radial-gradient(ellipse 110% 60% at 105% 110%, rgba(225,48,108,0.20) 0%, transparent 55%);
}

a { color: var(--ig-pink); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--ig-orange); }

::selection { background: rgba(225,48,108,0.3); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

/* === ANIMATED GRADIENT BORDER === */
.gradient-border { position: relative; }
.gradient-border::before {
  content: ''; position: absolute; inset: -2px;
  background: var(--ig-gradient-h); border-radius: inherit;
  z-index: -1; opacity: 0; transition: opacity 0.4s;
}
.gradient-border:hover::before { opacity: 1; }

/* === NAVBAR === */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(12,12,22,0.75); backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between; height: 68px;
}
.navbar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem; font-weight: 700;
  background: var(--ig-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  display: flex; align-items: center; gap: 0.5rem;
}
.navbar-logo svg { width: 28px; height: 28px; }
.navbar-links { display: flex; gap: 2rem; align-items: center; }
.navbar-links a {
  color: var(--text-secondary); font-weight: 500; font-size: 0.9rem;
  transition: var(--transition); position: relative;
}
.navbar-links a:hover { color: var(--text-primary); }
.navbar-links a.active { color: var(--text-primary); }
.navbar-links a.active::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--ig-gradient); border-radius: 1px;
}
.nav-badge {
  background: var(--ig-gradient); color: #fff; font-size: 0.65rem;
  padding: 0.15rem 0.5rem; border-radius: 20px; font-weight: 700; letter-spacing: 0.5px;
}

/* === HERO === */
.hero {
  position: relative; text-align: center;
  padding: 5rem 2rem 3.5rem;
  overflow: hidden;
  transition: padding 0.5s cubic-bezier(0.4,0,0.2,1);
}
/* Collapsed hero — after a search is done */
.hero.collapsed { padding: 1.5rem 2rem; }
.hero.collapsed .hero-badge,
.hero.collapsed h1,
.hero.collapsed > p,
.hero.collapsed .search-hint {
  opacity: 0; max-height: 0; margin: 0; overflow: hidden;
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(225,48,108,0.1); border: 1px solid rgba(225,48,108,0.2);
  padding: 0.4rem 1rem; border-radius: 30px; font-size: 0.78rem; color: var(--ig-pink);
  font-weight: 600; margin-bottom: 1.25rem; overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.4s ease;
  max-height: 50px;
}
.hero-badge .dot { width: 7px; height: 7px; background: var(--ig-pink); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800;
  line-height: 1.1; margin-bottom: 1rem;
  letter-spacing: -0.03em; overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.4s ease;
  max-height: 100px;
}
.hero h1 .gradient-text {
  background: var(--ig-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero > p {
  color: var(--text-secondary); font-size: 1rem; max-width: 500px;
  margin: 0 auto 2rem; line-height: 1.7; overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.4s ease, margin 0.4s ease;
  max-height: 90px;
}

/* === SEARCH BAR === */
.search-container { max-width: 600px; margin: 0 auto; position: relative; }
.search-bar {
  display: flex; align-items: center;
  background: rgba(24,24,40,0.9); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 60px; padding: 0.4rem;
  transition: var(--transition);
  box-shadow: 0 4px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.search-bar:focus-within {
  border-color: rgba(225,48,108,0.45);
  box-shadow: 0 0 0 3px rgba(225,48,108,0.12), 0 4px 40px rgba(0,0,0,0.35);
}
.search-bar .icon { padding: 0 0.75rem 0 1.25rem; color: var(--text-muted); display: flex; }
.search-bar input {
  flex: 1; background: none; border: none; color: var(--text-primary);
  font-size: 1rem; font-family: inherit; padding: 0.8rem 0; outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar .search-btn {
  background: var(--ig-gradient); border: none; color: #fff;
  padding: 0.8rem 2rem; border-radius: 50px; font-weight: 700;
  font-size: 0.9rem; cursor: pointer; font-family: inherit;
  transition: var(--transition); white-space: nowrap;
}
.search-bar .search-btn:hover { transform: scale(1.04); filter: brightness(1.12); }

.search-hint {
  margin-top: 0.85rem; font-size: 0.82rem; color: var(--text-muted);
  overflow: hidden; max-height: 40px;
  transition: opacity 0.25s ease, max-height 0.35s ease, margin 0.35s ease;
}
/* Stagger collapse so elements fade out sequentially, not all at once */
.hero.collapsed .hero-badge   { transition-delay: 0s; }
.hero.collapsed h1             { transition-delay: 0.04s; }
.hero.collapsed > p            { transition-delay: 0.07s; }
.hero.collapsed .search-hint   { transition-delay: 0.07s; }

/* === FEATURES === */
.features { max-width: 1200px; margin: 0 auto; padding: 5rem 2rem; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: linear-gradient(145deg, #1d1d32 0%, #181828 100%);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius); padding: 2.25rem;
  transition: var(--transition); position: relative; overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.feature-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}
.feature-card:hover {
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-4px);
  box-shadow: 0 16px 60px rgba(0,0,0,0.5), 0 0 30px rgba(131,58,180,0.1);
}
.feature-card .icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.25rem; font-size: 1.5rem;
}
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.6rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.87rem; line-height: 1.65; }

/* === PROFILE PAGE === */
.profile-section { max-width: 960px; margin: 0 auto; padding: 2rem; }

.profile-header {
  display: flex; gap: 2.5rem; align-items: center;
  padding: 2.5rem;
  background: linear-gradient(135deg, #1e1e38 0%, #181828 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); margin-bottom: 2rem;
  box-shadow: 0 4px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
}
.profile-avatar {
  width: 120px; height: 120px; border-radius: 50%; overflow: hidden;
  background: var(--ig-gradient); padding: 3px; flex-shrink: 0;
}
.profile-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 3px solid #1e1e38;
}
.profile-avatar .placeholder {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg-secondary); display: flex; align-items: center;
  justify-content: center; font-size: 2.5rem; color: var(--text-muted);
  border: 3px solid #1e1e38;
}
.profile-info { flex: 1; }
.profile-info .username {
  font-family: 'Space Grotesk'; font-size: 1.5rem; font-weight: 700;
  display: flex; align-items: center; gap: 0.5rem;
}
.profile-info .fullname { color: var(--text-secondary); font-size: 0.95rem; margin-top: 0.25rem; }
.profile-info .bio { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.75rem; line-height: 1.55; }
.profile-stats { display: flex; gap: 2rem; margin-top: 1.25rem; }
.profile-stats .stat { text-align: center; }
.profile-stats .stat .num { font-weight: 800; font-size: 1.2rem; display: block; }
.profile-stats .stat .label { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* === CONTENT TABS === */
.content-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.content-tab {
  flex: 1; padding: 1rem; text-align: center; cursor: pointer;
  color: var(--text-muted); font-weight: 600; font-size: 0.85rem;
  border-bottom: 2px solid transparent; transition: var(--transition);
  text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.content-tab:hover { color: var(--text-secondary); }
.content-tab.active { color: var(--text-primary); border-bottom-color: var(--ig-pink); }

/* === STORIES ROW === */
.stories-row {
  display: flex; gap: 1.1rem; overflow-x: auto; padding: 1rem 0;
  scrollbar-width: none; min-height: 80px; align-items: center;
}
.stories-row::-webkit-scrollbar { display: none; }
.story-circle {
  flex-shrink: 0; cursor: pointer; text-align: center; transition: var(--transition);
}
.story-circle:hover { transform: scale(1.06); }
.story-ring {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--ig-gradient); padding: 3px;
}
.story-ring img, .story-ring .placeholder {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--bg-primary);
}
.story-ring .placeholder {
  background: var(--bg-card); display: flex; align-items: center;
  justify-content: center; color: var(--text-muted); font-size: 1.2rem;
}
.story-label {
  margin-top: 0.5rem; font-size: 0.72rem; color: var(--text-secondary);
  max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* === POSTS GRID === */
.posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.post-item {
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  background: linear-gradient(145deg, #1d1d32 0%, #181828 100%);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.22s;
  box-shadow: 0 2px 14px rgba(0,0,0,0.3);
}
.post-item:hover {
  border-color: rgba(255,255,255,0.20);
  transform: translateY(-3px);
  box-shadow: 0 10px 35px rgba(0,0,0,0.5);
}
.post-thumb {
  aspect-ratio: 1; overflow: hidden; position: relative; flex-shrink: 0;
}
.post-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: var(--transition);
}
.post-item:hover .post-thumb img { transform: scale(1.05); filter: brightness(0.70); }
.post-thumb .overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; gap: 1.5rem; opacity: 0; transition: var(--transition);
  background: rgba(0,0,0,0.3);
}
.post-item:hover .post-thumb .overlay { opacity: 1; }
.post-thumb .overlay span {
  display: flex; align-items: center; gap: 0.4rem;
  font-weight: 700; font-size: 0.9rem; color: #fff;
}
.post-thumb .post-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; color: rgba(255,255,255,0.25); font-size: 1.5rem;
}
.post-card-caption {
  padding: 10px 12px 6px; font-size: 0.84rem; color: var(--text-secondary); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1; min-height: 28px; margin: 0;
}
.post-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  height: 40px; padding: 0 10px; border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.post-card-stats {
  display: flex; gap: 6px; align-items: center; flex: 1; justify-content: center; overflow: hidden;
}
.stat-pair {
  display: flex; gap: 3px; align-items: center; white-space: nowrap;
  font-size: 0.74rem; color: var(--text-muted);
}
.si { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; font-size: 0.92rem; line-height: 1; flex-shrink: 0; }
.sv { font-size: 0.86rem; line-height: 1; }
.post-card-dl {
  background: rgba(34,197,94,0.18);
  border: 1px solid rgba(74,222,128,0.45);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  color: #4ade80;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.post-card-dl:hover {
  background: rgba(34,197,94,0.32);
  border-color: rgba(74,222,128,0.70);
  color: #86efac;
}

/* === STORY VIEWER (FULLSCREEN) === */
.story-viewer-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(16px);
  display: none; align-items: center; justify-content: center;
  gap: 20px; padding: 0 16px;
}
.story-viewer-overlay.active { display: flex; }

/* External highlight preview panels (flanking the story card) */
.hl-preview-panel {
  display: flex; flex-direction: column; align-items: center; gap: 0.55rem;
  cursor: pointer; opacity: 0.72; transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0; width: 72px;
}
.hl-preview-panel:hover { opacity: 1; transform: scale(1.05); }
.hl-preview-ring {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--ig-gradient); padding: 2px; flex-shrink: 0;
}
.hl-preview-ring img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(0,0,0,0.8);
}
.hl-preview-ring .hl-preview-placeholder {
  width: 100%; height: 100%; border-radius: 50%;
  background: #111; border: 2px solid rgba(0,0,0,0.8);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5); font-size: 0.75rem; font-weight: 700;
}
.hl-preview-name {
  font-size: 0.68rem; color: rgba(255,255,255,0.75); text-align: center;
  max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.story-viewer {
  width: 100%; max-width: 420px; height: 90vh; max-height: 760px;
  background: #111120; border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden; position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 50px rgba(131,58,180,0.15);
}
.story-progress { display: flex; gap: 3px; padding: 12px 12px 0; position: absolute; top: 0; left: 0; right: 0; z-index: 10; }
.story-progress .bar { flex: 1; height: 2px; background: rgba(255,255,255,0.25); border-radius: 1px; overflow: hidden; }
.story-progress .bar .fill { height: 100%; background: #fff; border-radius: 1px; transition: width 0.1s linear; }
.story-viewer-header {
  position: absolute; top: 16px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 0.5rem; z-index: 10;
  padding-top: 8px;
}
.story-viewer-header .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.story-viewer-header .name { font-weight: 600; font-size: 0.85rem; }
.story-viewer-header .time { font-size: 0.75rem; color: rgba(255,255,255,0.6); }
.story-viewer-close {
  position: absolute; top: 20px; right: 16px; z-index: 10;
  background: none; border: none; color: #fff; font-size: 1.5rem;
  cursor: pointer; opacity: 0.8; transition: opacity 0.2s;
}
.story-viewer-close:hover { opacity: 1; }
.story-viewer-content {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: #000;
}
.story-viewer-content img { width: 100%; height: 100%; object-fit: cover; }
/* Left/right tap zones with subtle arrow indicators */
.story-viewer-nav {
  position: absolute; top: 0; bottom: 0; width: 40%; cursor: pointer; z-index: 5;
  display: flex; align-items: center;
}
.story-viewer-nav.prev { left: 0; justify-content: flex-start; padding-left: 14px; }
.story-viewer-nav.next { right: 0; justify-content: flex-end; padding-right: 14px; }
.story-viewer-nav::after {
  content: '';
  display: block;
  width: 10px; height: 10px;
  border-top: 2.5px solid rgba(255,255,255,0.55);
  border-right: 2.5px solid rgba(255,255,255,0.55);
  opacity: 0; transition: opacity 0.2s;
}
.story-viewer-nav.prev::after { transform: rotate(-135deg); }
.story-viewer-nav.next::after { transform: rotate(45deg); }
.story-viewer:hover .story-viewer-nav::after { opacity: 1; }
/* Action bar — just download button, centered */
.story-viewer-actions {
  position: absolute; bottom: 16px; left: 12px; right: 12px;
  display: flex; gap: 0.5rem; z-index: 10; justify-content: center;
}
/* Mobile-only highlight nav pills — flex items inside story-viewer-actions */
.hl-mobile-nav {
  background: rgba(15,15,35,0.82);
  border: 1px solid rgba(255,255,255,0.26);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  color: #fff; cursor: pointer; font-family: inherit;
  font-size: 0.74rem; font-weight: 600;
  padding: 7px 11px; border-radius: 24px;
  align-items: center; gap: 4px;
  max-width: 36%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 1;
  /* Hidden by default; JS sets display:flex when inside a highlight */
  display: none;
}
.hl-mobile-nav:active { background: rgba(40,40,70,0.85); }
/* Force-hide on desktop regardless of JS inline style */
@media (min-width: 769px) {
  .hl-mobile-nav { display: none !important; }
}

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.5rem; border-radius: 12px;
  font-weight: 600; font-size: 0.9rem; border: none;
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.btn-gradient { background: var(--ig-gradient); color: #fff; }
.btn-gradient:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255,255,255,0.08); color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.22); }
.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.8rem; border-radius: 9px; }

/* === HOW IT WORKS === */
.how-section { max-width: 1200px; margin: 0 auto; padding: 5rem 2rem; }
.how-section h2 {
  font-family: 'Space Grotesk'; font-size: 2rem; text-align: center; margin-bottom: 0.5rem;
}
.how-section .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 3rem; }
.how-steps { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }
.how-step {
  flex: 1; min-width: 220px; max-width: 300px; text-align: center;
  padding: 2.25rem 2rem;
  background: linear-gradient(145deg, #1d1d32 0%, #181828 100%);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius); transition: var(--transition);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}
.how-step:hover {
  border-color: rgba(255,255,255,0.16);
  transform: translateY(-5px);
  box-shadow: 0 14px 50px rgba(0,0,0,0.5);
}
.how-step .step-num {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--ig-gradient); display: inline-flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 1.1rem; margin-bottom: 1rem;
}
.how-step h3 { margin-bottom: 0.5rem; font-size: 1rem; }
.how-step p { color: var(--text-secondary); font-size: 0.85rem; }

/* === FOOTER === */
.footer {
  border-top: 1px solid rgba(255,255,255,0.07); padding: 3rem 2rem;
  text-align: center; color: var(--text-muted); font-size: 0.8rem;
}
.footer-links { display: flex; gap: 2rem; justify-content: center; margin-bottom: 1rem; }
.footer-links a { color: var(--text-secondary); font-size: 0.85rem; }

/* === AD SLOT === */
.ad-slot {
  background: rgba(255,255,255,0.02); border: 1px dashed rgba(255,255,255,0.08);
  border-radius: var(--radius-sm); padding: 1rem; text-align: center;
  color: var(--text-muted); font-size: 0.75rem; margin: 2rem auto;
  max-width: 728px; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}

/* === LOADING SKELETON === */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, #1a1a2e 25%, #20203a 50%, #1a1a2e 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

/* === TOAST === */
.toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: #1e1e38; border: 1px solid rgba(255,255,255,0.12);
  color: #fff; padding: 0.8rem 1.5rem;
  border-radius: 12px; font-weight: 600; font-size: 0.85rem;
  transform: translateY(100px); opacity: 0; transition: var(--transition);
  z-index: 1100; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* === POST GRID BADGES === */
.post-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.badge-reel {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.65); color: #fff;
  padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.7rem; font-weight: 700;
}
.badge-carousel {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.55);
  padding: 0.25rem 0.35rem; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}

/* === POST MODAL === */
.post-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(16px);
  display: none; align-items: center; justify-content: center;
  gap: 16px; padding: 1rem;
}
.post-modal-overlay.active { display: flex; }

/* Post prev/next navigation (outside modal card) */
.post-nav-btn {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; font-size: 1.8rem; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; z-index: 10;
}
.post-nav-btn:hover { background: rgba(255,255,255,0.25); }

.post-modal {
  display: flex; width: 100%; max-width: 960px;
  /* Fixed height prevents layout shift when comments load */
  height: clamp(420px, 88vh, 88vh); max-height: 88vh;
  background: linear-gradient(145deg, #1e1e36 0%, #181828 100%);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1); overflow: hidden; position: relative;
  box-shadow: 0 30px 100px rgba(0,0,0,0.8), 0 0 60px rgba(131,58,180,0.15);
}

.post-modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8); font-size: 0.95rem; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.post-modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.post-type-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 0.72rem;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 10px;
}
.post-type-badge.photo { background: rgba(131,58,180,0.18); color: #c080ff; }
.post-type-badge.reel  { background: rgba(225,48,108,0.18); color: #ff6b9d; }
.post-type-badge.carousel { background: rgba(252,175,69,0.18); color: #fcaf45; }

.post-modal-image {
  flex: 0 0 56%; background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
  min-height: 400px;
}
.post-modal-image img,
.post-modal-image video {
  width: 100%; height: 100%; object-fit: contain;
  display: block;
}

/* Carousel arrows */
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.65); border: 1px solid rgba(255,255,255,0.15);
  color: #fff; width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s; backdrop-filter: blur(4px);
}
.carousel-arrow:hover { background: rgba(0,0,0,0.85); }
.carousel-arrow.prev { left: 12px; }
.carousel-arrow.next { right: 12px; }

/* Carousel counter */
.carousel-counter {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.65); color: #fff;
  padding: 0.2rem 0.65rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;
  backdrop-filter: blur(4px); z-index: 5;
}

/* Download button (image panel) */
.modal-download-btn {
  position: absolute; bottom: 14px; right: 14px; z-index: 5;
  background: rgba(0,0,0,0.68);
  border: 1px solid rgba(255,255,255,0.30);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  color: #fff; padding: 0.5rem 1rem; border-radius: 40px;
  cursor: pointer; font-size: 0.78rem; font-weight: 600;
  display: flex; align-items: center; gap: 0.45rem;
  transition: background 0.2s, border-color 0.2s;
}
.modal-download-btn:hover {
  background: rgba(0,0,0,0.75);
  border-color: rgba(255,255,255,0.45);
}
/* Story viewer download button */
#storyDownloadBtn {
  background: rgba(0,0,0,0.65) !important;
  border: 1px solid rgba(255,255,255,0.30) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35) !important;
  border-radius: 40px !important;
  padding: 0.55rem 1.2rem !important;
  font-size: 0.82rem !important;
  color: #fff !important;
  transition: background 0.2s !important;
}
#storyDownloadBtn:hover {
  background: rgba(0,0,0,0.72) !important;
  border-color: rgba(255,255,255,0.44) !important;
}

/* Right info panel */
.post-modal-side {
  flex: 1; display: flex; flex-direction: column; position: relative;
  overflow: hidden; border-left: 1px solid rgba(255,255,255,0.07); min-width: 0;
}

.post-modal-info {
  padding: 1.35rem 1.35rem 1rem; flex: 1; overflow-y: auto;
}

.post-modal-stats {
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center;
  font-size: 0.82rem; font-weight: 600; margin-bottom: 0.75rem;
}

.post-modal-caption {
  color: var(--text-secondary); font-size: 0.88rem; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; margin-top: 0.75rem;
}

.post-modal-comments {
  flex: 0; overflow-y: auto; padding: 0 1.35rem 1.35rem;
  display: flex; flex-direction: column; gap: 0.65rem;
}

.comments-heading {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-secondary); margin-bottom: 0.25rem;
}
.comments-loading, .comments-empty { color: var(--text-muted); font-size: 0.82rem; }
.post-modal-ig-divider {
  margin: 1rem 0; border-top: 1px solid rgba(255,255,255,0.08);
}
.view-on-ig-btn {
  display: inline-block; font-size: 0.82rem;
  color: #4ade80; text-decoration: none; opacity: 0.8;
}
.view-on-ig-btn:hover { opacity: 1; text-decoration: underline; }

.post-modal-comment { font-size: 0.84rem; line-height: 1.55; }
.post-modal-comment .comment-user { font-weight: 700; color: var(--text-primary); margin-right: 0.4rem; }
.post-modal-comment .comment-text { color: var(--text-secondary); }

/* === POST MODAL MOBILE NAV ROW === */
.post-modal-nav-row {
  display: none; /* shown only on mobile via override below */
}
@media (max-width: 768px) {
  .post-modal-nav-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 6px; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .post-modal-nav-btn {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85); font-size: 1.5rem; line-height: 1;
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
  }
  .post-modal-nav-btn:active { background: rgba(255,255,255,0.18); }
  .post-modal-nav-count {
    font-size: 0.78rem; color: var(--text-muted); font-weight: 600; flex: 1; text-align: center;
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .navbar-links { display: none; }
  .navbar-inner { height: 58px; padding: 0 1rem; }

  .hero { padding: 3.5rem 1.25rem 2.5rem; }
  .hero.collapsed { padding: 1rem 1.25rem; }
  .hero h1 { font-size: clamp(2.6rem, 11vw, 3.4rem); }
  .hero > p { font-size: 0.92rem; margin-bottom: 1.5rem; }
  .hero-badge { font-size: 0.72rem; margin-bottom: 1rem; }
  /* Icon-only search button on mobile — text hidden, arrow shown via ::after */
  .search-bar .search-btn {
    font-size: 0; /* hides "View Profile" text */
    padding: 0;
    width: 46px; height: 46px; min-width: 46px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .search-bar .search-btn::after {
    content: '→';
    font-size: 1.25rem;
    color: #fff;
    line-height: 1;
  }
  /* 16px prevents iOS focus zoom */
  .search-bar input { font-size: 16px; }

  /* Tabs — scrollable row on mobile so all 4 fit without wrapping */
  .content-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
  .content-tabs::-webkit-scrollbar { display: none; }
  .content-tab { flex: 0 0 auto; padding: 0.75rem 0.8rem; font-size: 0.72rem; letter-spacing: 0.4px; }

  /* Loading skeleton — prevent fixed-width children from overflowing */
  #loadingState { padding: 0.75rem !important; }
  #loadingState > div:first-child { padding: 1rem !important; overflow: hidden; }
  #loadingState .skeleton { max-width: 100%; }

  .profile-section { padding: 0.5rem; }
  .profile-header { flex-direction: column; text-align: center; gap: 1.25rem; padding: 1.5rem 1rem; }
  .profile-avatar { width: 90px; height: 90px; }
  .profile-stats { justify-content: center; gap: 1.25rem; }
  .profile-info .username { justify-content: center; font-size: 1.25rem; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  /* Hide captions on mobile to maximise thumbnail */
  .post-card-caption { display: none; }
  /* Horizontal stat row — single line, properly centered with DL button */
  .post-card-footer { height: 50px; padding: 0 8px; }
  .post-card-stats { flex: 1; justify-content: space-evenly; gap: 0; align-items: center; align-self: center; }
  .stat-pair { flex-direction: row; align-items: center; gap: 4px; font-size: 0.78rem; }
  .si { width: 18px; height: 18px; font-size: 0.9rem; }
  .sv { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); }
  /* Larger download button on mobile */
  .post-card-dl {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  }
  /* Bigger story download button on mobile */
  #storyDownloadBtn { padding: 0.85rem 1.75rem !important; font-size: 0.9rem !important; }
  /* Bigger X close button on stories */
  .story-viewer-close { font-size: 1.8rem; top: 14px; right: 14px;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35); border-radius: 50%; }

  .features { padding: 3rem 1.25rem; }
  .how-section { padding: 3rem 1.25rem; }

  /* Post modal — full-screen on mobile, rounded top */
  .post-modal-overlay { padding: 0; align-items: flex-end; }
  .post-modal {
    flex-direction: column;
    height: 100svh; max-height: 100svh;
    max-width: 100%; border-radius: 20px 20px 0 0;
  }
  .post-modal-image {
    flex: 0 0 auto;
    height: clamp(260px, 46vh, 440px);
    max-height: none; border-radius: 20px 20px 0 0; overflow: hidden;
  }
  /* Close button — reposition into image area on mobile */
  .post-modal-side { position: static; flex: 1; border-left: none;
    border-top: 1px solid rgba(255,255,255,0.07);
    max-height: unset; overflow-y: auto; }
  .post-modal-close {
    position: absolute; top: 14px; right: 14px; z-index: 30;
    width: 38px; height: 38px; font-size: 1.1rem;
    background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.25);
  }
  /* Bigger modal download button on mobile */
  .modal-download-btn { padding: 0.65rem 1.3rem; font-size: 0.84rem; }

  /* Story viewer — full width on mobile */
  .story-viewer { max-width: 100%; height: 100dvh; max-height: none; border-radius: 0; border: none; }
  .story-viewer-overlay { align-items: stretch; padding: 0; gap: 0; }
  .hl-preview-panel { display: none !important; }
  .carousel-arrow { width: 42px; height: 42px; font-size: 1.5rem; }
  .modal-download-btn { bottom: 8px; right: 8px; }
  /* Hide external post nav buttons on mobile — replaced by in-panel nav row */
  .post-nav-btn { display: none; }

  /* Story ring larger tap targets */
  .story-ring { width: 64px; height: 64px; }
  .story-label { max-width: 64px; }
}

@media (max-width: 480px) {
  html { font-size: 15px; }
  .features-grid { grid-template-columns: 1fr; }
  .how-steps { flex-direction: column; align-items: center; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  /* Column stat-pairs: icon stacked above value, three pairs side-by-side in 50px footer */
  .post-card-stats { display: flex; justify-content: space-around; align-items: center; }
  .stat-pair { flex-direction: column; align-items: center; gap: 6px; }
  .si { width: 20px; height: 20px; font-size: 1rem; }
  .sv { font-size: 0.75rem; line-height: 1; font-weight: 700; color: var(--text-secondary); }
  .search-hint { display: none; }
}
@media (max-width: 360px) {
  .profile-section { padding: 0.25rem; }
  .posts-grid { grid-template-columns: 1fr; gap: 6px; }
}
