/* ============================================================
 * 호미클럽 — 홈 (매거진형: 히어로 + 피드 + 우측 사이드바)
 * ============================================================ */

/* 2단 레이아웃: 본문 + 사이드바 */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  column-gap: var(--gap-col);
  align-items: start;
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
}
/* 그리드 자식이 뷰포트 넘게 늘어나지 않도록 (min-content 블로아웃 차단) */
.home-content { min-width: 0; }

/* 섹션 제목 (피드 머리) — 절제: 작은 고딕 라벨 + 가는 선 */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-8) 0 var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--hairline);
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-meta); font-weight: 600;
  letter-spacing: var(--tracking-wide); text-transform: none;
  color: var(--ink-700);
}
.section-head .more-link {
  font-family: var(--font-heading); font-size: var(--fs-caption); color: var(--ink-500);
}
.section-head .more-link:hover { color: var(--ink-900); }

/* ── 히어로 (대표글) ── */
.hero-card {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-6);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--space-2);
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.hero-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hero-media {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--ink-200), var(--ink-100));
  position: relative;
}
.hero-media .ph-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-500); font-family: var(--font-heading); font-size: var(--fs-caption);
  letter-spacing: var(--tracking-wide);
}
.hero-body { padding: var(--space-6) var(--space-6) var(--space-6) 0; }
.hero-body .cat-pin { margin-bottom: var(--space-2); }
.hero-title {
  font-family: var(--font-title);
  font-size: var(--fs-hero); line-height: var(--lh-heading);
  letter-spacing: var(--tracking-title); font-weight: 700;
  margin: 0 0 var(--space-2);
}
.hero-excerpt { color: var(--ink-700); margin: 0 0 var(--space-4); font-size: var(--fs-body); }
.post-meta {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-heading); font-size: var(--fs-caption); color: var(--ink-500);
}
.post-meta .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-300); }

/* ════════════════════════════════════════════════════
 * 히어로 슬라이더 (대표글 — 어드민 선택, 모바일 좌우 스와이프)
 * 카드는 피드와 동일한 .post-card 컴포넌트 → 글씨 규격 자동 통일
 * ════════════════════════════════════════════════════ */
.hero-slider { position: relative; margin: var(--space-2) 0 var(--space-6); min-width: 0; }
.slider-viewport { overflow: hidden; border-radius: var(--radius-lg); min-width: 0; }
.slider-track {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -ms-overflow-style: none; scrollbar-width: none;
  /* touch-action 은 기본(auto) 유지 — 가로 스와이프 스크롤 정상 동작 (pan-y 는 가로를 막아 제거) */
  overscroll-behavior-x: contain;      /* 첫·끝 슬라이드에서 뒤로가기/바운스 누수 차단 */
  -webkit-overflow-scrolling: touch;
}
.slider-track::-webkit-scrollbar { display: none; }

/* 슬라이드 = 카드. 한 화면에 하나씩, 스냅 */
.post-card--slide { flex: 0 0 100%; scroll-snap-align: start; }
.post-card--slide .card-media .ph-label,
.post-card--slide .card-media img { }
.post-card--slide .card-media img,
.post-card .card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 데스크톱: 대표글은 가로형(이미지 좌 · 내용 우)으로 크게, 글씨는 카드와 동일 */
@media (min-width: 768px) {
  .post-card--slide { display: grid; grid-template-columns: 1.3fr 1fr; align-items: stretch; }
  .post-card--slide .card-media { aspect-ratio: auto; min-height: 300px; height: 100%; }
  .post-card--slide .card-body { padding: var(--space-6); justify-content: center; gap: var(--space-2); }
  .post-card--slide .card-title { -webkit-line-clamp: 3; min-height: 0; }
  .post-card--slide .card-excerpt { -webkit-line-clamp: 3; }
}
/* 모바일: 한 장씩 가득(살짝 옆 카드 미리보기 없이 풀폭) 스와이프 */
@media (max-width: 767px) {
  .post-card--slide { flex-basis: 100%; }
}

/* 화살표 (데스크톱) */
.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-pill); box-shadow: var(--shadow-md);
  color: var(--ink-900); cursor: pointer; z-index: 2;
  transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.slider-arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.slider-arrow:hover { background: var(--ink-50); }
.slider-arrow.is-prev { left: var(--space-3); }
.slider-arrow.is-next { right: var(--space-3); }
.slider-arrow[disabled] { opacity: 0; pointer-events: none; }
@media (max-width: 767px) { .slider-arrow { display: none; } }

/* 점(dots) */
.slider-dots { display: flex; justify-content: center; gap: var(--space-4); margin-top: var(--space-3); }
.slider-dots .dot {
  position: relative;
  width: 7px; height: 7px; border-radius: 50%; border: 0;
  background: var(--ink-300); cursor: pointer; padding: 0;
  transition: background var(--t-fast) var(--ease), width var(--t-fast) var(--ease);
}
/* 점 터치 히트영역 확대 — 시각 7px 유지, 탭 영역 ~27px */
.slider-dots .dot::after { content: ""; position: absolute; inset: -10px; }
.slider-dots .dot.is-active { background: var(--ink-900); width: 18px; border-radius: var(--radius-pill); }

/* 무한 스크롤 로더·센티넬 */
.feed-loader { display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  color: var(--ink-500); font-family: var(--font-heading); font-size: var(--fs-meta); padding: var(--space-6) 0; }
.feed-loader[hidden] { display: none; }
.feed-loader .spin { width: 16px; height: 16px; border: 2px solid var(--ink-200); border-top-color: var(--ink-700);
  border-radius: 50%; animation: feedspin .7s linear infinite; }
@keyframes feedspin { to { transform: rotate(360deg); } }
.feed-sentinel { height: 1px; }

/* ── 피드 그리드 (카드) ── */
.feed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5) var(--space-4);
  margin-top: var(--space-6);
}
/* 피드 내 광고는 카드 한 셀 크기 — 별도 span 없이 카드와 같은 흐름 */

.post-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.post-card:active { transform: scale(.99); }   /* 터치 눌림 피드백 */
.card-media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--ink-200), var(--ink-100));
  position: relative;
}
.card-media .ph-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink-500); font-family: var(--font-heading); font-size: var(--fs-caption);
  letter-spacing: var(--tracking-wide);
}
.card-body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.card-body .cat-pin { margin-bottom: var(--space-1); }
.card-title {
  font-family: var(--font-title);
  font-size: var(--fs-h3); line-height: var(--lh-title); font-weight: 600;   /* 16→18 한 단계 ↑ */
  letter-spacing: var(--tracking-title); margin: 0;
  /* 대제목 항상 2행 — 길면 …, 짧아도 2행 높이 확보 */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(var(--lh-title) * 2em);
}
.card-excerpt {
  color: var(--ink-700); font-size: var(--fs-body); line-height: var(--lh-snug); margin: 6px 0 0;  /* 13→15 ↑ */
  /* 내용(본문 첫 문단) 항상 3행 — 넘치면 … */
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(var(--lh-snug) * 3em);
}
.card-body .post-meta { margin-top: auto; padding-top: var(--space-3); }

/* ───────────────────────── 사이드바 ───────────────────────── */
.sidebar { position: sticky; top: calc(var(--header-h) + var(--space-4)); display: grid; gap: var(--space-8); }
.side-block { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: var(--space-5); }
.side-block.is-ad { background: transparent; border: 0; padding: 0; }
.side-head {
  font-family: var(--font-heading); font-size: var(--fs-meta); font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-4); padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--hairline);
}

/* 인기글 리스트 (랭킹) */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.rank-item { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); align-items: start; }
.rank-num {
  font-family: var(--font-heading); font-weight: 700; font-size: var(--fs-h3);
  color: var(--ink-300); line-height: 1; letter-spacing: var(--tracking-tight);
}
.rank-item:nth-child(-n+3) .rank-num { color: var(--ink-900); }
.rank-link { font-family: var(--font-heading); font-size: var(--fs-meta); line-height: var(--lh-snug); color: var(--ink-900); }
.rank-link:hover { text-decoration: underline; }
.rank-meta { font-family: var(--font-heading); font-size: var(--fs-caption); color: var(--ink-500); margin-top: 4px; }

/* ───────────────────────── 반응형 ───────────────────────── */

/* 태블릿: 사이드바 아래로, 피드는 3열 유지 (전폭) */
@media (max-width: 1023px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-8); }
  .sidebar { position: static; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
  .sidebar .is-ad { grid-column: 1 / -1; display: grid; place-items: center; }
  .ad-rect { max-width: 300px; }
}

/* 좁은 태블릿~큰 폰: 피드 2열 */
@media (max-width: 767px) {
  .hero-card { grid-template-columns: 1fr; }
  .hero-media { aspect-ratio: 16 / 9; }
  .hero-body { padding: var(--space-5); }
  .hero-excerpt { font-size: 16px; }
  .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { grid-template-columns: 1fr; }
}

/* 작은 폰: 1열 */
@media (max-width: 479px) {
  .feed { grid-template-columns: minmax(0, 1fr); }
  .card-excerpt { font-size: var(--fs-body); }   /* 1열 풀폭에서 발췌 13→15px */
}
