@font-face {
  font-family: "Pretendard";
  src: url("https://cdn.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff")
    format("woff");
  font-weight: 400;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.content-area a {
  color: #d65136;
}

.content-area a:hover {
  color: #fcba03;
}

body {
  font-family: "Pretendard", sans-serif;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.header {
  grid-area: header;
  background-color: #d65136;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* 햄버거 메뉴를 위한 체크박스 숨기기 */
#menu-toggle {
  display: none;
}

.menu-button {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.menu-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar {
  grid-area: sidebar;
  background-color: #7a5637;
  padding: 1rem;
  transition: transform 0.3s ease;
}

.sidebar ul {
  list-style: none;
}

.sidebar li {
  margin-bottom: 0.5rem;
}

.sidebar a {
  display: block;
  padding: 0.75rem 1rem;
  color: white;
  text-decoration: none;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.sidebar a:hover {
  background-color: #e37e29;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.sidebar a.active {
  background-color: #e37e29;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.main {
  grid-area: main;
  background-color: #f5f4e4;
  padding: 2rem;
  overflow-y: auto;
  position: relative;
}

.main h1 {
  color: #7a5637;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  line-height: 1.6;
  min-height: 400px;
  position: relative;
}

.content ul {
  padding-left: 2em;
}

/* 로딩 스피너 */
.loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.loading.show {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #d65136;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 콘텐츠 페이드 애니메이션 */
.content-area {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.content-area.fade-out {
  opacity: 0.3;
}

/* 오버레이 */
.sidebar-overlay {
  display: none;
}

/* 에러 메시지 */
.error-message {
  color: #d65136;
  background-color: #ffe6e6;
  padding: 1rem;
  border-radius: 4px;
  border: 1px solid #ffcccc;
  margin-bottom: 1rem;
}

/* 태블릿 및 모바일 */
@media screen and (max-width: 768px) {
  .container {
    grid-template-areas:
      "header"
      "main";
    grid-template-columns: 1fr;
  }

  .menu-button {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 999;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
  }

  /* 체크박스가 체크되었을 때 사이드바 열기 */
  #menu-toggle:checked ~ .container .sidebar {
    transform: translateX(0);
  }

  /* 체크박스가 체크되었을 때 오버레이 보이기 */
  #menu-toggle:checked ~ .container .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
  }

  .main {
    padding: 1.5rem;
  }

  .content {
    padding: 1.5rem;
  }
}

/* 모바일 */
@media screen and (max-width: 480px) {
  .header {
    padding: 1rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .sidebar {
    width: 100%;
  }

  .main {
    padding: 1rem;
  }

  .main h1 {
    font-size: 1.5rem;
  }

  .content {
    padding: 1rem;
  }
}

/* 애니메이션 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content {
  animation: slideIn 0.5s ease-out;
}

/* 사이드바 닫기 버튼 */
.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s;
  display: none;
}

.close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

@media screen and (max-width: 768px) {
  .close-button {
    display: block;
  }
}

/* 페이지별 스타일 */
.page-title {
  color: #7a5637;
  margin-bottom: 1.5rem;
  font-size: 2rem;
  border-bottom: 2px solid #e37e29;
  padding-bottom: 0.5rem;
}

.profile-card {
  display: flex;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 2rem;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.avatar {
  width: 100px;
  height: 100px;
  background-color: #d65136;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  font-weight: bold;
  overflow: hidden;
  object-fit: cover;
}

.post-item {
  padding: 1.5rem;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
}

.post-item:hover {
  background-color: #f9f9f9;
}

.post-date {
  color: #666;
  font-size: 0.9rem;
}

/* 갤러리 컨테이너: 메이슨리 레이아웃의 핵심 */
.gallery-container {
  max-width: 1400px;
  margin: 0 auto;

  /* 화면 너비에 따라 컬럼 수를 지정합니다 */
  column-count: 4; /* 기본 4열 */
  column-gap: 15px; /* 컬럼(열) 사이의 간격 */
}

/* 갤러리 개별 아이템 */
.gallery-item {
  margin-bottom: 15px; /* 아이템 사이의 수직 간격 */
  break-inside: avoid; /* 아이템이 컬럼 중간에 잘리는 현상 방지! */
  border-radius: 10px;
  overflow: hidden; /* 이미지가 테두리를 벗어나지 않도록 함 */
  position: relative; /* 오버레이 효과를 위한 기준점 */
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 갤러리 아이템 안의 이미지 */
.gallery-item img {
  width: 100%; /* 부모 요소(gallery-item)에 꽉 차게 */
  height: auto; /* 이미지 비율 유지 */
  display: block; /* 이미지 하단의 불필요한 여백 제거 */
}

/* 마우스를 올렸을 때 나타나는 오버레이 효과 (선택 사항) */
.gallery-item .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0; /* 평소에는 숨김 */
  transition: opacity 0.3s ease; /* 부드러운 전환 효과 */
  font-size: 1.2em;
  font-weight: bold;
}

.gallery-item:hover .overlay {
  opacity: 1; /* 마우스를 올리면 나타남 */
}

/* --- 반응형 웹 디자인 --- */

/* 태블릿 사이즈 (예: 1024px 이하) */
@media (max-width: 1024px) {
  .gallery-container {
    column-count: 3;
  }
}

/* 모바일 사이즈 (예: 768px 이하) */
@media (max-width: 768px) {
  .gallery-container {
    column-count: 2;
  }
}

/* 아주 작은 화면 사이즈 (예: 480px 이하) */
@media (max-width: 480px) {
  .gallery-container {
    column-count: 1;
  }
}

.lightbox {
  display: none; /* 평소에는 숨겨둠 */
  position: fixed; /* 화면 전체에 고정 */
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85); /* 반투명 검은 배경 */

  /* 콘텐츠를 중앙에 정렬하기 위함 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content {
  max-width: 80%;
  max-height: 80%;
  border-radius: 5px;
}

/* 닫기 버튼 */
.close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.close:hover {
  color: #bbb;
}
