/* Huddle: friendly social network */
:root {
  --brand: #5b46e8;
  --brand-2: #ff6b8b;
  --brand-soft: #eeebff;
  --bg: #f2f1f7;
  --card: #ffffff;
  --ink: #1d1b2c;
  --muted: #6c6a80;
  --line: #e4e2ee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 27, 44, .06), 0 4px 14px rgba(29, 27, 44, .05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
button { font: inherit; cursor: pointer; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 22px; letter-spacing: -.5px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center;
}
.search {
  flex: 1; max-width: 420px;
  background: var(--bg); border: 1px solid transparent; border-radius: 999px;
  padding: 9px 16px; color: var(--muted); font-size: 14px;
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-size: 17px; position: relative;
}
.icon-btn .dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--brand-2); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}

/* Layout */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 20px;
  display: grid; grid-template-columns: 230px minmax(0, 1fr) 316px; gap: 24px;
  align-items: start;
}
.leftnav { position: sticky; top: 78px; }
.leftnav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px;
  font-weight: 600; color: #3a3850;
}
.leftnav a:hover { background: #fff; color: var(--ink); }
.leftnav a.active { background: var(--brand-soft); color: var(--brand); }
.leftnav .ico { width: 24px; text-align: center; font-size: 18px; }
.leftnav h4 { margin: 22px 14px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.leftnav .small { font-size: 12px; color: var(--muted); padding: 18px 14px; line-height: 1.7; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rail { display: flex; flex-direction: column; gap: 16px; align-self: stretch; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }

/* Avatars: gradient discs with initials */
.av {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, #7b6cf6, #b38cff);
}
.av.sm { width: 34px; height: 34px; font-size: 13px; }
.av.xs { width: 28px; height: 28px; font-size: 11px; }
.g1 { background: linear-gradient(135deg, #ff8a65, #ff5c8a); }
.g2 { background: linear-gradient(135deg, #36c9a6, #2a9df4); }
.g3 { background: linear-gradient(135deg, #f7b733, #fc4a1a); }
.g4 { background: linear-gradient(135deg, #5b46e8, #9b6bff); }
.g5 { background: linear-gradient(135deg, #00b4db, #0083b0); }
.g6 { background: linear-gradient(135deg, #8e5aff, #ff6bd6); }
.g7 { background: linear-gradient(135deg, #56ab2f, #a8e063); }
.g8 { background: linear-gradient(135deg, #434343, #8a8a8a); }

/* Composer */
.composer { display: flex; gap: 12px; align-items: flex-start; }
.composer .box {
  flex: 1; background: var(--bg); border-radius: 999px; padding: 11px 18px; color: var(--muted);
}
.composer-actions { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.composer-actions a {
  flex: 1; text-align: center; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #4a4860;
}
.composer-actions a:hover { background: var(--bg); }

/* Stories strip */
.stories { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.story {
  flex: none; width: 104px; height: 168px; border-radius: 14px; position: relative; overflow: hidden;
  color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: flex-end; padding: 10px;
  box-shadow: var(--shadow);
}
.story .av { position: absolute; top: 9px; left: 9px; width: 34px; height: 34px; font-size: 12px; border: 3px solid var(--brand); }
.story::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0,0,0,.45)); }
.story span { position: relative; z-index: 1; }

/* Posts */
.post-head { display: flex; gap: 11px; align-items: center; padding: 16px 18px 0; }
.post-head .who { line-height: 1.25; }
.post-head .name { font-weight: 700; }
.post-head .meta { font-size: 12.5px; color: var(--muted); }
.post-head .more { margin-left: auto; color: var(--muted); font-size: 20px; letter-spacing: 1px; }
.post-body { padding: 10px 18px 12px; }
.post-body p { margin: 0 0 8px; }
.post-body .tag { color: var(--brand); font-weight: 600; }
.photo {
  height: 300px; display: grid; place-items: center; font-size: 84px; position: relative; overflow: hidden;
}
.photo.short { height: 220px; }
.photo .caption {
  position: absolute; left: 14px; bottom: 12px; background: rgba(0,0,0,.4); color: #fff;
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
}
.ph-sunset { background: linear-gradient(180deg, #ffb88c 0%, #ff7e88 45%, #6b4c9a 100%); }
.ph-sea { background: linear-gradient(180deg, #a1e3ff 0%, #4fb4e8 55%, #1d6fa5 56%, #0e4c7a 100%); }
.ph-forest { background: radial-gradient(circle at 70% 25%, #fff6c9 0 8%, transparent 9%), linear-gradient(180deg, #c9f0d6, #4f9b6b 70%, #2f6b45); }
.ph-bake { background: repeating-linear-gradient(45deg, #fbe7d0 0 18px, #f6dcc0 18px 36px); }
.ph-city { background: linear-gradient(180deg, #1a1440 0%, #3b2d7a 55%, #f08a5d 100%); }
.ph-garden { background: radial-gradient(circle at 30% 70%, #ffd1e8 0 18%, transparent 19%), radial-gradient(circle at 75% 40%, #fff3a6 0 15%, transparent 16%), linear-gradient(135deg, #cdeccd, #8fd19e); }
.ph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ph-grid .photo { height: 180px; font-size: 56px; }

.post-stats {
  display: flex; justify-content: space-between; padding: 10px 18px; font-size: 13px; color: var(--muted);
}
.reacts { display: flex; align-items: center; gap: 6px; }
.reacts b { display: inline-flex; }
.reacts b i {
  font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; border: 2px solid #fff; margin-left: -5px; background: var(--brand-soft);
}
.reacts b i:first-child { margin-left: 0; }
.post-actions { display: flex; border-top: 1px solid var(--line); margin: 0 12px; padding: 4px 0; }
.post-actions a {
  flex: 1; text-align: center; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 14px; color: #4a4860;
}
.post-actions a:hover { background: var(--bg); color: var(--brand); }
.post-actions a.on { color: var(--brand-2); }
.comment { display: flex; gap: 9px; padding: 6px 18px 0; }
.comment .bubble { background: var(--bg); border-radius: 14px; padding: 7px 12px; font-size: 14px; }
.comment .bubble b { display: block; font-size: 13px; }
.comments { padding-bottom: 14px; }

.link-preview { margin: 0 18px 4px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.link-preview .lp-img { height: 140px; display: grid; place-items: center; font-size: 54px; }
.link-preview .lp-body { padding: 10px 14px; font-size: 13px; color: var(--muted); }
.link-preview .lp-body b { display: block; color: var(--ink); font-size: 15px; }

.poll { margin: 4px 18px 6px; display: grid; gap: 8px; }
.poll-opt { position: relative; border-radius: 10px; background: var(--bg); padding: 9px 14px; font-size: 14px; font-weight: 600; overflow: hidden; }
.poll-opt i { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); }
.poll-opt span { position: relative; display: flex; justify-content: space-between; }

/* Sponsored in-feed unit */
.sponsored .post-head .av { background: repeating-linear-gradient(45deg, #ececf3 0 6px, #f6f6fa 6px 12px); color: var(--muted); font-size: 18px; }
.sponsored-label { font-size: 12.5px; color: var(--muted); }
.ad-frame {
  min-height: 262px; padding: 6px 18px 16px; display: flex; justify-content: center; align-items: center;
}
.ad-note { text-align: right; padding: 0 18px 10px; font-size: 11px; color: #a3a1b5; }

/* Ad wrappers */
.ad-wrap { text-align: center; }
.ad-label {
  display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #a3a1b5; margin-bottom: 6px;
}
.ad-rail { position: sticky; top: 78px; min-height: 620px; padding: 12px 8px; }
.ad-mobile {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  box-shadow: 0 -4px 14px rgba(0,0,0,.06); min-height: 64px; padding: 4px 0 6px;
}
.ad-mobile .ad-label { margin-bottom: 2px; font-size: 9px; }

/* Right rail widgets */
.trend { display: block; padding: 8px 0; border-top: 1px solid var(--line); }
.trend:first-of-type { border-top: 0; }
.trend small { display: block; color: var(--muted); font-size: 12px; }
.trend b { font-size: 14.5px; }
.pymk { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.pymk .who { flex: 1; line-height: 1.25; font-size: 14px; }
.pymk .who small { color: var(--muted); font-size: 12px; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: 13px;
}
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.ghost:hover { color: var(--brand); }
.rail-foot { font-size: 12px; color: var(--muted); padding: 0 6px; line-height: 1.8; }
.rail-foot a { margin-right: 8px; }

/* Profile */
.profile-top { overflow: hidden; }
.cover {
  height: 230px; position: relative;
  background:
    radial-gradient(circle at 82% 30%, rgba(255,255,255,.55) 0 30px, transparent 31px),
    radial-gradient(ellipse at 20% 120%, #2f6b45 0 40%, transparent 41%),
    radial-gradient(ellipse at 65% 130%, #3f8a5a 0 45%, transparent 46%),
    linear-gradient(180deg, #ffcf9e 0%, #ff9a8b 55%, #a77bd6 100%);
}
.profile-id { display: flex; align-items: flex-end; gap: 18px; padding: 0 24px 18px; margin-top: -54px; position: relative; flex-wrap: wrap; }
.profile-id .av { width: 124px; height: 124px; font-size: 42px; border: 5px solid #fff; }
.profile-id h1 { margin: 0; font-size: 26px; letter-spacing: -.4px; }
.profile-id .handle { color: var(--muted); font-size: 14px; }
.profile-id .acts { margin-left: auto; display: flex; gap: 8px; }
.profile-stats { display: flex; gap: 26px; padding: 0 24px 16px; font-size: 14px; color: var(--muted); }
.profile-stats b { color: var(--ink); font-size: 16px; }
.tabs { display: flex; gap: 4px; border-top: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tabs a { padding: 13px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.about li { list-style: none; padding: 5px 0; font-size: 14px; }
.about ul { margin: 0; padding: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: 10px; overflow: hidden; }
.photo-grid div { aspect-ratio: 1; display: grid; place-items: center; font-size: 26px; }

/* Groups */
.page-title { display: flex; align-items: center; justify-content: space-between; }
.page-title h1 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 13px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--ink); color: #fff; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.group-card { overflow: hidden; display: flex; flex-direction: column; }
.group-card .gc-cover { height: 86px; display: grid; place-items: center; font-size: 38px; }
.group-card .gc-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.group-card b { font-size: 15px; line-height: 1.3; }
.group-card small { color: var(--muted); font-size: 12.5px; }
.group-card .btn { margin-top: auto; text-align: center; }
.group-banner { overflow: hidden; }
.group-banner .gb-cover {
  height: 170px; display: grid; place-items: center; font-size: 64px;
  background: radial-gradient(circle at 20% 30%, #fff3a6 0 10%, transparent 11%), linear-gradient(135deg, #36c9a6, #2a9df4);
}
.group-banner .gb-body { padding: 16px 22px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.group-banner h2 { margin: 0; font-size: 22px; }
.group-banner .gb-body p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.group-banner .members { display: flex; margin-left: auto; align-items: center; gap: 10px; }
.group-banner .members .av { border: 2px solid #fff; margin-left: -10px; }
.pinned { border-left: 4px solid var(--brand); }
.section-h { margin: 6px 4px 0; font-size: 18px; }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 76px minmax(0, 1fr) 316px; }
  .leftnav a span.lbl, .leftnav h4, .leftnav .small { display: none; }
  .leftnav a { justify-content: center; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 14px 12px 90px; }
  .leftnav, .rail { display: none; }
  .search { display: none; }
}
@media (max-width: 760px) {
  .ad-desktop { display: none !important; }
  .ad-mobile { display: block; }
  .photo { height: 240px; }
  .ph-grid .photo { height: 140px; }
  .group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-id { margin-top: -44px; padding: 0 16px 16px; }
  .profile-id .av { width: 96px; height: 96px; font-size: 32px; }
  .profile-id .acts { margin-left: 0; width: 100%; }
  .profile-stats { padding: 0 16px 14px; gap: 18px; }
  .cover { height: 160px; }
}
