/* ============================================
   Pixoas · style.css
   Light & Pop 디자인 시스템 (Vercel / Linear 지향)
   ============================================ */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100dvh; }
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ---------- 2. Design tokens ---------- */
:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-alt: #EDF1F7;
  --border: #E3E8F0;
  --border-soft: #ECEFF4;

  --ink: #10141C;
  --ink-soft: #5B6472;
  --ink-faint: #9AA3B2;

  --primary: #0EA968;
  --primary-dark: #078754;
  --primary-soft: #E3F8EE;

  --secondary: #3B6CF4;
  --secondary-soft: #EAF0FE;

  --pop: #E0399B;
  --pop-soft: #FDEAF4;

  --accent-gradient: linear-gradient(135deg, #0EA968 0%, #3B6CF4 100%);

  --shadow-sm: 0 2px 10px rgba(16, 20, 28, 0.05);
  --shadow-md: 0 10px 28px rgba(16, 20, 28, 0.07);
  --shadow-lg: 0 24px 56px rgba(16, 20, 28, 0.10);

  --header-bg: rgba(246, 247, 251, 0.82);
  --skel-shine: #E2E7F0;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 56px;

  --container: 1180px;

  --font-display: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- 2-1. 다크모드 토큰 (html[data-theme="dark"]) ---------- */
[data-theme="dark"] {
  --bg: #111319;
  --surface: #181B23;
  --surface-alt: #20232D;
  --border: #2B2F3A;
  --border-soft: #23262F;

  --ink: #F1F3F8;
  --ink-soft: #9CA3B2;
  --ink-faint: #6B7280;

  --primary: #22C57D;
  --primary-dark: #4ADE94;
  --primary-soft: #123326;

  --secondary: #6E8CFF;
  --secondary-soft: #1B2542;

  --pop: #F158B4;
  --pop-soft: #33172B;

  --accent-gradient: linear-gradient(135deg, #22C57D 0%, #6E8CFF 100%);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.46);

  --header-bg: rgba(17, 19, 25, 0.82);
  --skel-shine: #333947;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  letter-spacing: -0.01em;
  transition: background-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 16px; }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  transition: background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}

.header-top {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.brand { display: flex; align-items: center; flex-shrink: 0; }
.header-logo { height: 28px; width: auto; display: block; }

.header-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background-color 0.25s var(--ease-out);
}
.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.icon-search { color: var(--ink-faint); flex-shrink: 0; }
.header-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
}
.header-search-input::placeholder { color: var(--ink-faint); }

.header-utils {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.util-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.util-btn:hover { background: var(--surface-alt); color: var(--ink); }
.util-btn svg { display: block; }

.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* ---------- 4. 카테고리 탭 ---------- */
.category-nav { max-width: var(--container); margin: 0 auto; padding: 0 24px 16px; }

.tab-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tab-scroll::-webkit-scrollbar { display: none; }

.tab-track {
  position: relative;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-alt);
  border-radius: var(--radius-pill);
}

.tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.32s var(--ease-out), width 0.32s var(--ease-out);
  z-index: 0;
}

.tab-btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color 0.2s var(--ease-out);
}
.tab-btn.is-active { color: var(--ink); }

/* ---------- 5. 서브 검색 ---------- */
.subsearch {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.28s var(--ease-out), opacity 0.2s var(--ease-out), margin 0.28s var(--ease-out);
}
.subsearch.is-visible { max-height: 60px; opacity: 1; margin-top: 12px; }
.subsearch-input {
  width: 100%;
  max-width: 320px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-size: 13.5px;
  background: var(--surface);
  outline: none;
}
.subsearch-input:focus { border-color: var(--secondary); border-style: solid; }

/* ---------- 6. 슬림 배너 ---------- */
.slim-banner {
  max-width: var(--container);
  margin: 24px auto 44px;
  padding: 20px 28px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  text-align: center;
}
.slim-banner-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--primary-dark);
  text-transform: uppercase;
}
.slim-banner-main {
  margin-top: 8px;
  padding: 0 6px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.6;
  color: var(--ink);
  letter-spacing: -0.01em;
  transition: opacity 0.22s var(--ease-out);
}
.slim-banner-main.is-fading {
  opacity: 0;
}

/* ---------- 7. 피드 / 그리드 ---------- */
.feed { max-width: var(--container); margin: 0 auto; padding: 0 24px var(--space-xl); }

.feed-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}
.feed-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.feed-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); } }
@media (min-width: 1440px) { .post-grid { grid-template-columns: repeat(4, 1fr); } }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.post-card.is-skeleton { box-shadow: none; }

.post-card-link { display: flex; flex-direction: column; height: 100%; color: inherit; }
.post-card-link:hover .post-title { color: var(--primary-dark); }

.post-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--surface-alt);
  transition: transform 0.45s var(--ease-out);
}
.post-card:hover .post-thumb { transform: scale(1.05); }

.post-card-body { padding: var(--space-md); display: flex; flex-direction: column; gap: 8px; flex: 1; }

.post-badge {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}
.post-badge.badge-tools { color: var(--secondary); background: var(--secondary-soft); }
.post-badge.badge-toys { color: var(--pop); background: var(--pop-soft); }
.post-badge.badge-insights { color: var(--primary-dark); background: var(--primary-soft); }

/* 제목: 최대 2줄까지만 보여주고 ... 처리 */
.post-title { 
  font-size: 16px; 
  font-weight: 700; 
  line-height: 1.45; 
  color: var(--ink); 
  transition: color 0.2s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 요약 내용: 최대 3줄까지만 보여주고 ... 처리 */
.post-excerpt { 
  font-size: 13.5px; 
  color: var(--ink-soft); 
  line-height: 1.6; 
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }

/* ---------- 8. 스켈레톤 UI ---------- */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel {
  background: linear-gradient(100deg, var(--surface-alt) 30%, var(--skel-shine) 45%, var(--surface-alt) 60%);
  background-size: 300% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
.skel-thumb { aspect-ratio: 16 / 10; border-radius: 0; }
.skel-badge { width: 56px; height: 18px; border-radius: var(--radius-pill); }
.skel-line { width: 100%; height: 12px; }
.skel-line-lg { width: 85%; height: 16px; }
.skel-line-sm { width: 55%; }

/* ---------- 9. 빈 상태 ---------- */
.empty-state {
  text-align: center;
  padding: 96px 24px;
  color: var(--ink-soft);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.7;
}

/* ---------- 10. 애드센스 컨테이너 (오클릭 방지: 상하 150px 이상 여백) ---------- */
.ads-container {
  max-width: var(--container);
  margin: 160px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ads-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.ads-unit {
  display: block;
  width: 100%;
  min-height: 100px;
}

/* ---------- 11. 푸터 ---------- */
.site-footer { border-top: 1px solid var(--border-soft); background: var(--surface); }

.footer-top {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-xl) 24px var(--space-lg);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}
.footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.footer-logo { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.footer-tagline { font-size: 13px; color: var(--ink-faint); }
.footer-social { display: flex; gap: var(--space-md); }
.footer-social a { font-size: 13px; color: var(--ink-soft); transition: color 0.2s; }
.footer-social a:hover { color: var(--primary-dark); }

.footer-bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-md) 24px var(--space-lg);
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-sm);
}
.footer-copy { font-size: 12px; color: var(--ink-faint); }
.footer-legal { display: flex; gap: var(--space-md); }
.footer-legal-btn { font-size: 12px; color: var(--ink-faint); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal-btn:hover { color: var(--ink-soft); }

/* ---------- 12. 모달 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 18, 26, 0.44);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-overlay[hidden] { display: none; } /* [hidden] 어트리뷰트 셀렉터가 위 규칙보다 우선하도록 명시 */

@keyframes modal-pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-panel {
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-pop-in 0.3s var(--ease-out);
}
.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background 0.2s;
}
.modal-close:hover { background: var(--surface-alt); }

.modal-body { padding: var(--space-lg); font-size: 13.5px; color: var(--ink-soft); line-height: 1.8; }
.modal-body h3 { margin-top: var(--space-md); margin-bottom: 6px; font-size: 14.5px; color: var(--ink); }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: var(--space-sm); }

/* ---------- 13. 접근성 ---------- */
:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 14. 반응형 세부 조정 ---------- */
@media (max-width: 520px) {
  .header-top { flex-wrap: wrap; }
  .header-search { max-width: none; order: 3; flex-basis: 100%; }
  .header-utils { gap: 2px; }
  .util-btn { width: 34px; height: 34px; }
  .slim-banner { margin: 16px auto 36px; padding: 16px 20px; }
  .slim-banner-main { font-size: 15px; }
  .empty-state { padding: 80px 20px; font-size: 15px; }
}

/* ============================================
   15. 상세 페이지 (Detail Page) 전용 스타일
   ============================================ */

.detail-container {
  max-width: 800px;
  margin: 40px auto 100px;
  padding: 0 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 24px;
  transition: color 0.2s var(--ease-out);
}
.back-link:hover {
  color: var(--primary);
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 48px;
  box-shadow: var(--shadow-md);
  transition: background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}

.detail-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.detail-summary {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 36px;
}

.detail-divider {
  height: 1px;
  background: var(--border-soft);
  border: none;
  margin: 36px 0;
}

/* 본문(노션 콘텐츠) 세부 스타일 */
.detail-content {
  font-size: 16.5px;
  line-height: 1.85;
  color: var(--ink);
}

.detail-content p {
  margin-bottom: 24px;
}

.detail-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 48px 0 20px;
  color: var(--ink);
}

.detail-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 36px 0 16px;
  color: var(--ink);
}

.detail-content h4 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--ink);
}

/* 노션 글머리 기호(점, 숫자) 보이게 복구 */
.detail-content ul {
  list-style-type: disc;
  margin-left: 24px;
  margin-bottom: 24px;
}
.detail-content ol {
  list-style-type: decimal;
  margin-left: 24px;
  margin-bottom: 24px;
}
.detail-content li {
  margin-bottom: 8px;
}

/* 모바일 화면 대응 */
@media (max-width: 640px) {
  .detail-card {
    padding: 24px;
  }
  .detail-title {
    font-size: 24px;
  }
  .detail-summary {
    font-size: 16px;
  }
}
