/* * layout-modules.css - 블로그 그리드, 시뮬레이션 그리드, 슬라이드 등 레이아웃 모듈 통합
 * 이전: blog-grid.css, simulation-grid.css, slide.css 통합
 * 모든 테마에서 일관된 크기 유지
 */

/* ===== 메인 페이지 세로 리듬 ===== */
body.home-page {
  --home-header-height: 60px;
  --home-footer-height: 60px;
  --home-space-half: calc(var(--home-header-height) * 0.5);
  --home-space-full: var(--home-header-height);
  --home-space-one-and-half: calc(var(--home-header-height) * 1.5);
}

/* 헤더 높이(60px)를 기준으로 메인페이지의 세로 리듬을 맞춘다. */
body.home-page main > .container {
  padding-top: 0;
  padding-bottom: 0;
}

body.home-page .intro-section {
  margin-top: var(--home-space-half);
  margin-bottom: 0;
}

body.home-page .blog-section {
  margin-top: var(--home-space-full);
  margin-bottom: var(--home-space-one-and-half);
}

body.home-page .section-title {
  margin-top: 0;
  margin-bottom: var(--home-space-half);
}

body.home-page .posts-grid-center {
  margin-bottom: var(--home-space-half);
}

body.home-page .view-all-container {
  margin-top: 0;
  margin-bottom: 0;
}

/* 내부 요소의 가로 위치는 유지하고 세로 높이를 1 : 1로 맞춘다. */
html body.home-page .top-header {
  height: var(--home-header-height);
}

html body.home-page footer {
  display: flex;
  align-items: center;
  height: var(--home-footer-height);
  min-height: var(--home-footer-height);
  padding-top: 0;
  padding-bottom: 0;
}

/* ===== 1. 블로그 그리드 레이아웃 ===== */
.posts-grid,
.posts-grid-center {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-10); /* 카드 사이 여백 증가 */
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto var(--spacing-12);
  padding: 0;
  box-sizing: border-box;
}

.posts-grid > *,
.posts-grid-center > * {
  min-width: 0; /* 그리드 넘침 방지 */
}

/* ===== 2. 슬라이드 컨테이너 (히어로 내부 최적화) ===== */
.slide-container {
  position: relative;
  width: 100%;
  min-height: 320px;
  height: 100%;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}

html.dark-theme .slide-container {
  background-color: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 2.5rem;
  opacity: 0;
  z-index: 1;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide.active {
  opacity: 1;
  z-index: 2;
}

.slide h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--github-accent);
  font-weight: 800;
  width: 100%;
  text-align: center;
}

.slide p {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-secondary);
  width: 100%;
  text-align: center;
}

/* ===== 6. 통합 인트로(히어로) 섹션 ===== */
.intro-section {
  width: 100%;
  max-width: var(--content-max-width); /* 부모에 max-width를 주고 */
  margin: var(--spacing-12) auto;
  padding: 0; /* 화면 가장 바깥선까지 상자가 꽉 차도록 패딩 제거 */
  box-sizing: border-box;
}

.intro-container {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 완벽한 5:5 대칭 */
  gap: var(--spacing-10);
  align-items: stretch;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: 24px;
  padding: var(--spacing-10);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  width: 100%;
  margin: 0 auto;
}

.intro-profile-area {
  display: flex;
  flex-direction: row; /* 이미지와 텍스트 가로 배치 */
  align-items: center;
  gap: var(--spacing-8);
  min-width: 0;
}

.intro-image-area {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  background: white;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  padding: 6px;
  box-shadow: 0 10px 20px rgba(9, 105, 218, 0.2);
  animation: blob-morph 8s ease-in-out infinite;
}

@keyframes blob-morph {
  0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
  50% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
}

.intro-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.intro-content-area {
  flex: 1;
  min-width: 0;
}

.intro-content-area h2 {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.intro-content-area p {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  text-align: left;
  width: 100%;
}

.intro-links {
  display: flex;
  gap: var(--spacing-4);
}

/* ===== 3. 포스트 카드 스타일 ===== */
.post-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  /* 카드 전체를 합성 레이어로 올리지 않도록 시각 속성만 전환한다. */
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  height: 100%; 
  display: flex;
  flex-direction: column; 
  position: relative;
  overflow: hidden; 
  min-height: 440px;
}

.post-card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card-tags {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-2);
}

.post-card-tag-more {
  display: inline-flex;
  align-items: center;
  min-height: var(--button-height-sm);
  color: var(--text-tertiary);
  font-size: var(--button-font-size-sm);
}

.post-card:hover {
  border-color: var(--github-accent);
  box-shadow: var(--shadow-md);
}

.post-card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-card-title {
  font-size: 1.4rem;
  line-height: 1.4;
  font-weight: 700;
  margin: 0 0 0.5rem;
  text-align: left;
  width: 100%;
}

.post-card-content {
  padding: 1.5rem;
  flex-grow: 1;
}

.post-card-image-wrapper {
  width: 100%;
  height: 180px;
  overflow: hidden;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.post-card-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-preview-text {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
}

.post-card-footer {
  padding: 0.8rem 1.5rem;
}

/* ===== 4. 모든 포스트 보기 버튼 액션 ===== */
.view-all-container {
  display: flex;
  justify-content: center;
  margin: var(--spacing-12) auto;
  width: 100%;
  max-width: 1200px;
}

.btn-view-all {
  gap: var(--spacing-3);
}

.btn-view-all i {
  transition: transform 0.3s ease;
}

.btn-view-all:hover i {
  transform: translateX(6px);
}

/* ===== 7. 모바일 반응형 레이아웃 오버라이드 ===== */
@media (max-width: 768px) {
  /* 블로그 그리드 1열로 변경 */
  .posts-grid,
  .posts-grid-center {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-8);
  }

  /* 인트로 컨테이너 1열로 변경 */
  .intro-container {
    grid-template-columns: 1fr;
    gap: var(--spacing-6);
    padding: var(--spacing-5);
    border-radius: 16px;
  }

  /* 프로필 가로배치 -> 세로배치 및 중앙정렬 */
  .intro-profile-area {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--spacing-4);
  }

  .intro-image-area {
    width: 120px;
    height: 120px;
  }

  .intro-content-area h1,
  .intro-content-area h2,
  .intro-content-area p {
    text-align: center;
  }

  .intro-content-area h1 {
    font-size: 1.8rem;
  }

  .intro-links {
    justify-content: center;
  }

  /* 슬라이더 높이 조절 및 글자 크기 축소 */
  .slide-container {
    min-height: 240px;
  }

  .slide {
    padding: 1.5rem;
  }

  .slide h2 {
    font-size: 1.6rem;
  }

  .slide p {
    font-size: 0.95rem;
  }

  /* 포스트 카드 높이 유연화 */
  .post-card {
    min-height: auto;
  }

  .post-card-header,
  .post-card-content,
  .post-card-footer {
    padding: 1.2rem;
  }

  .post-card-title {
    font-size: 1.25rem;
  }

  .post-card-image-wrapper {
    height: 150px;
  }
}
