/**
 * SNS-style responsive home (Threads / Instagram feed feel)
 */
:root {
  --sns-feed-max: 680px;
  --sns-tab-h: 56px;
  --sns-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sns-story-gradient: linear-gradient(135deg, #9fd89f, #5a9f6e, #3d7a52);
  --sns-card-radius: 16px;
  --sns-border: rgba(255, 255, 255, 0.08);
}

body.sns-home-page {
  padding-bottom: calc(var(--sns-tab-h) + var(--sns-safe-bottom) + 8px);
}

body.sns-home-page #aside {
  display: none !important;
}

body.sns-home-page #container_wr {
  display: block !important;
  max-width: 100% !important;
}

body.sns-home-page #container {
  float: none !important;
  width: 100% !important;
  max-width: var(--sns-feed-max) !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

/* —— Header strip —— */
.sns-home {
  width: 100%;
  max-width: var(--sns-feed-max);
  margin: 0 auto;
}

.sns-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(16, 20, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sns-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sns-avatar,
.sns-compose-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container, #005318);
  color: var(--md-sys-color-on-primary-container, #b8f0b8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.sns-greeting {
  margin: 0;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant, #c2c8bd);
}

.sns-username {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sns-header-actions {
  display: flex;
  gap: 4px;
}

.sns-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface, #e2e3de) !important;
  font-size: 0;
}
.sns-icon-btn .fa {
  font-size: 17px;
  line-height: 1;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sns-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* —— Stories —— */
.sns-stories {
  display: flex;
  gap: 14px;
  padding: 12px 16px 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sns-stories::-webkit-scrollbar { display: none; }

.sns-story {
  flex: 0 0 auto;
  width: 64px;
  text-align: center;
  scroll-snap-align: start;
  color: inherit !important;
}

.sns-story-ring {
  display: block;
  padding: 2px;
  border-radius: 50%;
  background: var(--sns-story-gradient);
  margin: 0 auto 6px;
  width: 52px;
  height: 52px;
  box-sizing: border-box;
}

.sns-story-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-high, #272b27);
  border: 2px solid var(--md-sys-color-surface, #101410);
  box-sizing: border-box;
}
.sns-story-thumb .fa {
  font-size: 18px;
  line-height: 1;
  color: var(--md-sys-color-on-surface, #e2e3de);
}

.sns-story-label {
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant, #c2c8bd);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* —— Compose row —— */
.sns-compose {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 12px 16px;
  padding: 12px 14px;
  background: var(--md-sys-color-surface-container, #1d211d);
  border-radius: var(--sns-card-radius);
  border: 1px solid var(--sns-border);
}

.sns-compose-prompt {
  flex: 1;
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant, #c2c8bd) !important;
}

.sns-compose-action {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--md-sys-color-primary, #9fd89f);
  color: var(--md-sys-color-on-primary, #003910) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
}
.sns-compose-action .fa {
  font-size: 15px;
  line-height: 1;
}

/* —— Feed —— */
.sns-feed {
  padding: 0 0 24px;
}

.sns-feed .latest_top_wr,
.sns-feed .latest_wr {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 12px;
  float: none !important;
}

.sns-feed .lt_wr {
  float: none !important;
  width: 100% !important;
  margin: 0 !important;
}

.sns-feed .lat,
.sns-feed .pic_li_lt,
.sns-feed .pic_blk {
  border-radius: var(--sns-card-radius) !important;
  border: 1px solid var(--sns-border) !important;
  overflow: hidden;
  background: var(--md-sys-color-surface-container, #1d211d) !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.sns-feed .lat_title,
.sns-feed .lat h2 {
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 14px 16px !important;
  border-bottom: 1px solid var(--sns-border) !important;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sns-feed .lat_title a,
.sns-feed .lat h2 a {
  color: var(--md-sys-color-on-surface, #e2e3de) !important;
}

.sns-feed .lat ul li,
.sns-feed .pic_li_lt li {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--sns-border) !important;
  transition: background 0.15s ease;
}

.sns-feed .lat ul li:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sns-feed .lat ul li:last-child {
  border-bottom: none !important;
}

.sns-feed .lat ul li a {
  font-size: 14px !important;
  line-height: 1.45 !important;
}

/* Hide old hero on home when using sns */
.sns-home .vc-hero.soop-hero {
  display: none;
}

/* —— Bottom tab bar (mobile-first, also tablet) —— */
.sns-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: calc(var(--sns-tab-h) + var(--sns-safe-bottom));
  padding-bottom: var(--sns-safe-bottom);
  background: rgba(16, 20, 16, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--sns-border);
}

.sns-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant, #8c9388) !important;
  min-height: var(--sns-tab-h);
  line-height: 1.2;
}

.sns-tab > .fa {
  font-size: 20px;
  line-height: 1;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sns-tab.is-active {
  color: var(--md-sys-color-primary, #9fd89f) !important;
}

.sns-tab--primary {
  gap: 2px;
}

.sns-tab-fab {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-sys-color-primary, #9fd89f);
  color: var(--md-sys-color-on-primary, #003910);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.sns-tab-fab .fa {
  font-size: 16px;
  line-height: 1;
  font-weight: bold;
}

.sns-tab--primary.is-active .sns-tab-fab {
  filter: brightness(1.08);
}

/* Desktop: tab bar centered under feed */
@media (min-width: 900px) {
  .sns-tabbar {
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--sns-feed-max);
    border-radius: 16px 16px 0 0;
    border-left: 1px solid var(--sns-border);
    border-right: 1px solid var(--sns-border);
  }

  body.sns-home-page #hd_wrapper,
  body.sns-home-page #gnb {
    max-width: 100%;
  }

  #ft {
    margin-bottom: calc(var(--sns-tab-h) + 16px);
  }
}

/* Tablet+: slightly wider stories */
@media (min-width: 600px) {
  .sns-stories {
    justify-content: flex-start;
    padding-left: max(16px, calc(50% - var(--sns-feed-max) / 2 + 16px));
  }
}

/* Reduce legacy header noise on home */
body.sns-home-page #hd_define,
body.sns-home-page .hd_login {
  font-size: 12px;
}

@media (max-width: 767px) {
  body.sns-home-page #tnb .inner {
    font-size: 11px;
  }
  body.sns-home-page #logo img.soop-logo-img {
    height: 26px !important;
  }
}

.sns-feed .pic_lt ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 12px;
}
.sns-feed .pic_lt .galley_li { margin: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; }
.sns-feed .pic_lt .lt_img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sns-feed .pic_lt .galley_li > a:not(.lt_img) { display: none; }
@media (max-width: 480px) {
  .sns-feed .pic_lt ul { grid-template-columns: repeat(2, 1fr); }
}

/* 피드 latest 아이콘 (다운로드·링크·하트 등) */
.sns-feed .lt .fa,
.sns-feed .lat .fa {
  font-size: 11px !important;
  line-height: 1 !important;
  vertical-align: middle;
  margin-left: 2px;
}
.sns-feed .lt_page .fa {
  font-size: 14px !important;
}
.sns-feed .lt_more {
  font-size: 12px !important;
  padding: 10px 14px !important;
}

/* 숲 포토카드 스트림 (게시판 비어 있어도 SNS 피드 유지) */
.sns-forest-stream {
  margin: 0 12px 16px;
  padding: 14px 14px 12px;
  border-radius: var(--sns-card-radius);
  border: 1px solid var(--sns-border);
  background: var(--md-sys-color-surface-container, #1d211d);
}
.sns-forest-stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.sns-forest-stream-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.sns-forest-stream-title .fa {
  font-size: 14px;
  margin-right: 6px;
  color: var(--md-sys-color-primary, #9fd89f);
}
.sns-forest-stream-more {
  font-size: 12px;
  color: var(--md-sys-color-primary, #9fd89f) !important;
}
.sns-forest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sns-forest-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit !important;
}
.sns-forest-card img,
.sns-forest-card-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--md-sys-color-surface-container-high, #272b27);
}
.sns-forest-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}
.sns-forest-card-placeholder .fa { font-size: 22px; opacity: 0.5; }
.sns-forest-card-label {
  font-size: 11px;
  line-height: 1.3;
  color: var(--md-sys-color-on-surface-variant, #c2c8bd);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.sns-home-page #ft,
body.sns-home-page #aside,
body.sns-home-page hr {
  display: none !important;
}

body.sns-home-page #tnb,
body.sns-home-page #hd_define,
body.sns-home-page .hd_login,
body.sns-home-page #hd_sch,
body.sns-home-page .hd_sch_wr .popular,
body.sns-home-page #gnb {
  display: none !important;
}

body.sns-home-page #hd_wrapper {
  max-width: var(--sns-feed-max);
  margin: 0 auto;
}

.sns-feed .empty_li {
  padding: 16px !important;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant, #c2c8bd);
  font-size: 13px;
}