/* ============================================================
   Instagram-style Portfolio — styles
   Colors/theme yahan se change kar sakte ho (:root variables)
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #fafafa;
  --panel: #fff;
  --border: #dbdbdb;
  --text: #262626;
  --text2: #8e8e8e;
  --blue: #0095f6;
  --red: #ff3040;
  --link: #00376b;
  --chip: #efefef;
  --ig-gradient: conic-gradient(from 210deg at 50% 50%, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
}
[data-theme="dark"] {
  --bg: #000;
  --panel: #000;
  --border: #262626;
  --text: #f5f5f5;
  --text2: #a8a8a8;
  --link: #b3d4ff;
  --chip: #262626;
}

/* overflow-x clip: drag karke edge ke bahar rakhe elements se
   sideways scrollbar na aaye; gutter stable = scrollbar aane-jaane
   pe layout shift nahi */
html { overflow-x: clip; scrollbar-gutter: stable; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  transition: background .25s, color .25s;
  overflow-x: clip;
}
/* overlay khula ho to page apni scroll position pe frozen rahe
   (top inline JS se set hota hai — lockScroll/unlockScroll) */
body.no-scroll {
  overflow: hidden;
  position: fixed;
  left: 0; right: 0; width: 100%;
}
button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

/* ---------------- splash (loading) screen ---------------- */
.splash {
  position: fixed; inset: 0; z-index: 300;
  background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity .5s ease, visibility .5s;
}
.splash-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 5px; text-transform: uppercase;
  color: var(--text2);
  animation: splashFade 1s ease .3s both;
}
.splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-glyph {
  width: 88px; height: 88px;
  animation: splashPop .9s cubic-bezier(.2, .8, .3, 1.2) both;
}
@keyframes splashPop {
  0%   { transform: scale(.6);  opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
.splash-from {
  position: absolute; bottom: 42px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  animation: splashFade 1s ease .35s both;
}
.splash-from span { font-size: 12px; color: var(--text2); letter-spacing: .4px; }
.splash-from b {
  font-size: 17px; font-weight: 700;
  background: linear-gradient(90deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
@keyframes splashFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- top nav ---------------- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 975px; margin: 0 auto; height: 60px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo-wrap { display: flex; align-items: center; gap: 10px; }
.logo { font-family: "Grand Hotel", cursive; font-size: 30px; line-height: 1; padding-top: 4px; }
.logo-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; color: var(--text2); white-space: nowrap;
}
.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--chip); color: var(--text2);
  border-radius: 8px; padding: 8px 14px;
  width: min(268px, 30vw);
}
.searchbox svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.nav-icons { display: flex; align-items: center; gap: 6px; }
.icon-btn { padding: 8px; border-radius: 8px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--chip); }
.icon-btn svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
}
.icon-btn.pulse svg { animation: pulse .5s ease; }
@keyframes pulse { 40% { transform: scale(1.35); } }
#themeBtn { font-size: 20px; }

/* ---------------- layout ---------------- */
main { max-width: 935px; margin: 0 auto; padding: 84px 20px 40px; }

/* ---------------- profile header ---------------- */
.profile { display: flex; gap: 30px; margin-bottom: 24px; }
.avatar-col { flex: 1; display: flex; justify-content: center; align-items: flex-start; }

.avatar-ring {
  background: var(--ig-gradient);
  border-radius: 50%; padding: 3px;
  display: inline-block; flex-shrink: 0;
}
.avatar-ring img, .avatar-ring .avatar-fallback {
  display: block; border-radius: 50%;
  border: 3px solid var(--panel);
  object-fit: cover; background: var(--chip);
}
.avatar-ring.big img, .avatar-ring.big .avatar-fallback { width: 150px; height: 150px; }
.avatar-ring.mini { padding: 2px; }
.avatar-ring.mini img, .avatar-ring.mini .avatar-fallback { width: 32px; height: 32px; border-width: 2px; }
.avatar-fallback {
  display: grid !important; place-items: center;
  font-size: 56px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #962fbf, #d62976) !important;
}
.avatar-ring.mini .avatar-fallback { font-size: 14px; }

.profile-info { flex: 2.2; min-width: 0; }
.profile-row1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.username { font-size: 20px; font-weight: 400; }
.badge svg { width: 18px; height: 18px; }
.badge.mini svg { width: 14px; height: 14px; }
.profile-btns { display: flex; gap: 8px; margin-left: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px;
  font-weight: 600; font-size: 14px; line-height: 1.2;
  transition: filter .15s;
}
.btn:hover { filter: brightness(.92); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--chip); color: var(--text); }
#followBtn.following { background: var(--chip); color: var(--text); }

.stats { list-style: none; display: flex; gap: 40px; margin-bottom: 20px; }
.stats b { font-weight: 600; }
.stats-mobile { display: none; }

.bio { font-size: 14px; }
.fullname-row { font-weight: 600; }
.category { color: var(--text2); }
.bio-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--link); font-weight: 600; margin-top: 2px;
}
.bio-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------------- story highlights ---------------- */
.highlights {
  display: flex; gap: 28px;
  padding: 8px 0 24px;
  overflow-x: auto; scrollbar-width: none;
}
.highlights::-webkit-scrollbar { display: none; }
.highlight { display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; }
.highlight-ring {
  width: 77px; height: 77px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--panel);
  display: grid; place-items: center;
  transition: transform .15s;
}
.highlight:hover .highlight-ring { transform: scale(1.05); }
.highlight-circle {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--chip);
  display: grid; place-items: center; font-size: 28px;
}
.highlight-name { font-size: 12px; }

/* ---------------- tabs ---------------- */
.tabs { display: flex; justify-content: center; gap: 60px; border-top: 1px solid var(--border); }
.tab {
  display: flex; align-items: center; gap: 6px;
  padding: 16px 0; margin-top: -1px;
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  color: var(--text2);
  border-top: 1px solid transparent;
}
.tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.tab.active { color: var(--text); border-top-color: var(--text); }

/* ---------------- posts grid ---------------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile {
  position: relative; aspect-ratio: 1; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: #fff; text-align: center;
}
.tile-emoji { font-size: clamp(36px, 6vw, 60px); }
.tile-title {
  font-weight: 700; font-size: clamp(13px, 1.8vw, 18px);
  text-shadow: 0 1px 6px rgba(0,0,0,.35); padding: 0 10px;
}
.tile-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.42);
  display: flex; align-items: center; justify-content: center; gap: 28px;
  font-weight: 700; font-size: 16px;
  opacity: 0; transition: opacity .15s;
}
.tile-overlay span { display: inline-flex; align-items: center; gap: 8px; }
.tile-overlay svg { width: 20px; height: 20px; }
.tile:hover .tile-overlay { opacity: 1; }

/* ---------------- skills ---------------- */
.skills { padding: 28px 4px; }
.skill-group { margin-bottom: 26px; }
.skill-group h3 { font-size: 15px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--chip); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
}

/* ---------------- contact ---------------- */
.contact { padding: 32px 4px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.contact h2 { font-size: 20px; }
.contact p { color: var(--text2); text-align: center; max-width: 420px; }
.contact-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; width: 100%; max-width: 560px; margin-top: 8px;
}
.contact-card {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); background: var(--panel);
  padding: 14px 16px; border-radius: 12px;
  transition: transform .15s, box-shadow .15s;
}
.contact-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.cc-emoji { font-size: 26px; }
.cc-info { display: flex; flex-direction: column; min-width: 0; }
.cc-info b { font-size: 14px; }
.cc-info span {
  font-size: 13px; color: var(--text2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.footer { text-align: center; color: var(--text2); font-size: 12px; padding: 36px 0 20px; }

/* ---------------- overlays ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay-close {
  position: absolute; top: 14px; right: 18px; z-index: 5;
  color: #fff; font-size: 28px; line-height: 1; padding: 6px;
}
.story-overlay { background: rgba(0,0,0,.92); }

/* ---------------- post modal ---------------- */
.post-card {
  display: flex;
  width: min(1040px, 100%); height: min(660px, 92vh);
  background: var(--panel); border-radius: 6px; overflow: hidden;
}
.post-cover {
  position: relative; flex: 1.4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: #fff; cursor: pointer; user-select: none;
}
.post-cover-emoji { font-size: 96px; }
.post-cover-title { font-size: 26px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
.post-side {
  flex: 1; min-width: 320px;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
}
.post-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.post-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.post-caption > b { margin-right: 6px; }
#pmTags { color: var(--link); font-weight: 600; }
#pmTags span { margin-right: 8px; }
.post-links { display: flex; gap: 10px; flex-wrap: wrap; }
.comment { margin-bottom: 10px; }
.comment b { margin-right: 6px; }
.post-actions { border-top: 1px solid var(--border); padding: 10px 16px 14px; }
.action-row { display: flex; gap: 6px; margin-bottom: 6px; }
.action-row .right { margin-left: auto; }
#pmHeart.liked svg { fill: var(--red); stroke: var(--red); animation: pulse .4s ease; }
.likes-line { font-weight: 600; }
.time-line { font-size: 10px; letter-spacing: .5px; color: var(--text2); margin-top: 4px; }

.heart-pop {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none; color: #fff;
  animation: heartPop .9s ease forwards;
}
.heart-pop svg { width: 110px; height: 110px; filter: drop-shadow(0 4px 16px rgba(0,0,0,.35)); }
@keyframes heartPop {
  0%   { transform: scale(0);    opacity: 0; }
  25%  { transform: scale(1.25); opacity: 1; }
  55%  { transform: scale(1);    opacity: 1; }
  100% { transform: scale(1);    opacity: 0; }
}

/* ---------------- story viewer ---------------- */
.story-card {
  position: relative;
  width: min(400px, 100%); height: min(760px, 92vh);
  border-radius: 14px; overflow: hidden; color: #fff;
  display: flex; flex-direction: column;
}
.story-progress {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 4px; z-index: 3;
}
.pbar { flex: 1; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; overflow: hidden; }
.pfill { display: block; width: 0; height: 100%; background: #fff; }
.story-head {
  position: absolute; top: 22px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px; z-index: 3;
}
.story-ava {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: grid; place-items: center; font-size: 16px;
}
.story-time { color: rgba(255,255,255,.8); font-size: 12px; }
.story-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  padding: 70px 34px 60px; text-align: center;
}
.story-emoji { font-size: 72px; }
.story-content h2 { font-size: 26px; font-weight: 800; }
.story-content p { font-size: 16px; line-height: 1.6; color: rgba(255,255,255,.92); }
.story-zone { position: absolute; top: 70px; bottom: 0; z-index: 2; }
.story-zone.left { left: 0; width: 38%; }
.story-zone.right { right: 0; width: 62%; }

/* ---------------- bottom nav (mobile) ---------------- */
.bottomnav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--panel); border-top: 1px solid var(--border);
  height: 52px;
}
.bottomnav button { flex: 1; display: grid; place-items: center; }
.bottomnav svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.bn-avatar img, .bn-avatar .avatar-fallback {
  width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; font-size: 12px;
}

/* ---------------- draggable elements ---------------- */
.draggable { position: relative; }
.draggable.dragging {
  cursor: grabbing; opacity: .92;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
  transition: none;
}
body.drag-active { user-select: none; -webkit-user-select: none; }

#resetLayout {
  position: fixed; right: 16px; bottom: 72px; z-index: 400;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
#dragTip {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 400; max-width: min(92vw, 440px); text-align: center;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .4s, transform .4s;
}
#dragTip.show { opacity: 1; transform: translate(-50%, 0); }

/* ================= MOBILE ================= */
@media (max-width: 767px) {
  main { padding: 76px 0 84px; }
  .searchbox { display: none; }
  .nav-inner { padding: 0 16px; }

  .profile { gap: 0; padding: 0 16px; margin-bottom: 8px; }
  .avatar-col { flex: 0 0 auto; margin-right: 24px; }
  .avatar-ring.big img, .avatar-ring.big .avatar-fallback { width: 86px; height: 86px; }
  .avatar-fallback { font-size: 34px; }
  .profile-row1 { margin-bottom: 12px; }
  .username { font-size: 18px; }
  .profile-btns { width: 100%; margin-left: 0; }
  .profile-btns .btn { flex: 1; }
  .stats-desktop { display: none; }

  .stats-mobile {
    display: flex; justify-content: space-around; text-align: center;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    padding: 10px 0; margin: 14px 0 4px;
  }
  .stats-mobile li { display: flex; flex-direction: column; }
  .stats-mobile span { color: var(--text2); font-size: 13px; }

  .highlights { padding: 14px 16px 18px; gap: 18px; }
  .highlight-ring { width: 64px; height: 64px; }
  .highlight-circle { width: 53px; height: 53px; font-size: 24px; }

  .tabs { gap: 0; }
  .tab { flex: 1; justify-content: center; }
  .tab span { display: none; }
  .tab svg { width: 22px; height: 22px; }

  .grid { gap: 2px; }
  .skills, .contact { padding-left: 16px; padding-right: 16px; }
  .bottomnav { display: flex; }

  .overlay { padding: 10px; }
  .post-card { flex-direction: column; height: min(92vh, 780px); width: 100%; }
  .post-cover { flex: 0 0 44%; }
  .post-cover-emoji { font-size: 64px; }
  .post-cover-title { font-size: 20px; }
  .post-side { border-left: 0; border-top: 1px solid var(--border); min-width: 0; }
}
