/* ==========================================================================
   CRENU Editorial & Post Stylesheet
   Modern Web Standard compliant, clean editorial design.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Brand & Core Palette */
  --pink: #ff4787;
  --pink-hover: #ff2a73;
  --pink-subtle: rgba(255, 71, 135, 0.08);

  --bg-canvas: #161618;
  --bg-surface: #1e1e21;
  --bg-surface-elevated: #26262a;
  --bg-subtle: rgba(255, 255, 255, 0.03);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --font-sans: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 4px;
  border-radius: 4px;
}

.wrap {
  width: min(860px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* ==========================================================================
   Global Site Header (상단 fix 제거하여 제목 침범 버그 원천 차단)
   ========================================================================== */
.site-header {
  position: relative; /* fixed/sticky 해제 */
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header nav {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  transition: opacity 0.15s ease;
}

.logo:hover {
  opacity: 0.85;
}

.logo img {
  display: block;
  width: 3.5rem;
  height: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--text-secondary);
}

.nav-links a:hover,
.nav-links .nav-active {
  color: var(--text-primary);
}

.nav-links .contact {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.nav-links .contact:hover {
  border-color: var(--pink);
  color: var(--pink);
}

/* ==========================================================================
   인앱 스타일 상단 바 (In-App TopBar UI - 상세 페이지 전용)
   ========================================================================== */
.inapp-topbar {
  position: relative;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 0;
}

.inapp-topbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.75rem;
}

.inapp-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  margin-left: -0.6rem;
  border-radius: 0.5rem;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.inapp-back-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.inapp-back-link svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inapp-brand-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.inapp-brand-title img {
  width: 1.25rem;
  height: 1.25rem;
}

.inapp-action-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--pink);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--pink-subtle);
  background: var(--pink-subtle);
  border-radius: 9999px;
  transition: background-color 0.15s ease;
}

.inapp-action-btn:hover {
  background: rgba(255, 71, 135, 0.16);
}

/* ==========================================================================
   컨텐츠 목록 페이지 (/posts/) - 거창한 헤더 없이 바로 게시글 리스트
   ========================================================================== */
.post-list-section {
  padding-block: 2rem 5rem;
}

.post-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 직관적인 블로그/매거진 스타일의 게시글 카드 */
.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: 1.75rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  overflow: hidden;
  padding: 1.25rem;
  align-items: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.feed-item:hover {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.feed-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.feed-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.feed-item:hover .feed-thumbnail img {
  transform: scale(1.03);
}

.feed-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 0.5rem;
}

.feed-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  text-wrap: balance;
}

.feed-item:hover .feed-title {
  color: var(--pink);
}

.feed-summary {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-wrap: pretty;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-feature-settings: "tnum";
}

.feed-meta-author {
  color: var(--text-secondary);
  font-weight: 500;
}

.feed-link-overlay {
  position: absolute;
  inset: 0;
  border-radius: 1rem;
}

/* ==========================================================================
   게시글 상세 페이지 (/posts/{id}/) - 상단 고정 없음! 정상 문서 흐름
   ========================================================================== */
.post-article-wrap {
  max-width: 44rem; /* 약 70ch */
  margin-inline: auto;
  padding: 2.5rem 1.25rem 6rem;
}

/* 게시글 제목 영역: 절대 고정(sticky/fixed)시키지 않음 */
.post-header {
  position: static !important; /* 상단 고정 방지 */
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.post-meta-line {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.post-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.65rem, 3.2vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.35;
  text-wrap: balance;
  color: var(--text-primary);
}

.post-lead {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0;
  text-wrap: pretty;
}

/* 아티클 본문 타이포그래피 */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
  color: #d4d4d8;
}

.post-content h2 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin: 3.25rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  text-wrap: balance;
}

.post-content p {
  margin: 0 0 1.35rem;
  text-wrap: pretty;
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.5rem;
  padding-inline-start: 1.35rem;
}

.post-content li {
  margin-bottom: 0.5rem;
  text-wrap: pretty;
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* 콜아웃 박스 */
.editorial-callout {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  background-color: var(--bg-subtle);
  border-left: 3px solid var(--pink);
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.9125rem;
  line-height: 1.65;
  color: #e4e4e7;
}

.editorial-callout-title {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
}

.editorial-callout p {
  margin: 0;
}

/* 인앱 UI 디바이스 프레임 시각화 */
.post-visual {
  margin: 2.5rem 0;
  text-align: center;
}

.device-frame {
  display: inline-block;
  max-width: 100%;
  width: min(22rem, 100%);
  background: #0d0d0f;
  padding: 0.65rem;
  border-radius: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1.5rem 3rem -0.5rem rgba(0, 0, 0, 0.6);
}

.device-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1.75rem;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bg-surface);
}

.post-visual figcaption {
  margin-top: 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  text-wrap: balance;
}

/* 투명성 안내 디스클로저 */
.editorial-disclosure {
  margin-top: 3.5rem;
  padding: 0.875rem 1.15rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.editorial-disclosure p {
  margin: 0;
}

.editorial-disclosure strong {
  color: var(--text-secondary);
}

/* 앱 다운로드 CTA */
.post-action {
  margin: 3.5rem 0 2rem;
  padding: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  text-align: center;
}

.post-action h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  text-wrap: balance;
}

.post-action p {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  background-color: var(--pink);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--pink-hover);
  color: #ffffff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--text-primary);
}

/* 글 하단 페이지네이션 */
.post-pagination {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
}

.post-pagination a {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.post-pagination a:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  border-top: 1px solid var(--border-subtle);
  padding-block: 2.5rem;
  margin-top: auto;
  font-size: 0.8125rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

footer .logo img {
  width: 2.75rem;
}

footer p {
  color: var(--text-tertiary);
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: var(--text-tertiary);
}

.footer-links a:hover {
  color: var(--text-primary);
}

.legal-notice {
  padding-block: 1rem 1.5rem;
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  line-height: 1.5;
}

.legal-notice p {
  margin: 0;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 48rem) {
  .wrap {
    width: calc(100% - 2rem);
  }

  .site-header nav {
    height: 3.5rem;
  }

  .nav-links .contact {
    display: none;
  }

  .feed-item {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  .feed-thumbnail {
    aspect-ratio: 16 / 9;
  }

  .post-article-wrap {
    padding-inline: 1rem;
    padding-block: 1.75rem 4rem;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
}

/* 공식 스토어 다운로드 배지 (메인 index.html과 동일 사양) */
.stores {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 1rem;
}

.store-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.store-button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.store-button img {
  display: block;
  height: 48px;
  width: auto;
}
