/* ========== 공통 변수 설정 ========== */
:root {
  --primary-color: #274c77;
  --secondary-color: #f9f9f9;
  --third-color: #f9f9f9;
  --white: #ffffff;
  --border-color: #ddd;
  --text-color: #666;
  --text-color2: #191919;
  --shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  --font-family: Arial, sans-serif;
  --header-height: 4.375rem;   /* 70px */
  --padding-base: 1.25rem;     /* 20px */
  --box-radius: 0.3125rem;     /* 5px */
  --transition-speed: 0.3s;
}

/* ----- 바디 ----- */
body {
  font-family: var(--font-family);
  height: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background-color: var(--secondary-color);
}

/* ----- 헤더 ----- */
header {
  background-color: var(--primary-color);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--padding-base);
  color: var(--white);
}

.header-left {
  display: flex;
  align-items: center;
  font-family: 'esamanru Medium';
}

.header-logo {
  height: 2.7rem; /* 40px */
  margin-left: 0.3125rem; /* 5px */
  vertical-align: middle; 
  cursor: pointer;
}

header .logo {
  font-weight: bold;
  cursor: pointer;
  font-size: 1.875rem; /* 기존: 30px (30/16) */
  margin: 0.625rem;    /* 기존: 10px (10/16) */
  margin-bottom: 0;
}

header nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.875rem;     /* 기존: 30px (30/16) */
  margin: 0.625rem;    /* 기존: 10px (10/16) */
  flex: 1;
  font-family: 'Eugro L';
}

header .header-link {
  color: var(--white);
  text-decoration: none;
  font-size: 1.3rem; /* 20px */
  font-weight: bold;
  padding: 0.3125rem 0.625rem; /* 5px 10px */
  transition: background-color 0.3s ease, transform 0.3s ease;
}
header .header-link:hover {
  background-color: rgba(255, 255, 255, 0.2); /* 원하는 배경 효과 */
  border-radius: 4px;
  transform: scale(1.05);
}

h1 {
  cursor: pointer;
}

#mainContainer {
    display: grid;
    grid-template-rows: auto;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
    background-color: #f9f9f9;
    /* 높이는 내부 내용에 따라 자동 */
}
.box {
    background-color: #ffffff;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s forwards;
    height: 200px;
}

#Box1 {
  position: relative;
  text-align: center;
}

/* 이미지 크기 조절 및 반응형 설정 */
.factor-image {

  object-fit: cover; 
  max-height: 200px;
  display: block;
  margin: 0 auto;
  outline: 5px solid white;
  outline-offset: -5px;

}

/* 버튼 중앙 정렬 */
.factor-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  font-size: 1.2rem;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.1s ease;
}

.factor-button:hover {
  transform: scale(0.95) translate(-50%, -50%);
  top: 50%;
  left: 50%;
}













/* ----- 공통 canvas 스타일 ----- */
canvas {
    max-width: 100%;
    background-color: #fefefe;
 }
  
/* fadeInUp 애니메이션 keyframes 정의 */
@keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
}

/* mainContainer의 자식 박스들에 그룹별 딜레이 적용 */
#mainContainer > .box:nth-child(1),
#mainContainer > .box:nth-child(2) {
  animation-delay: 0.2s;
}

#mainContainer > .box:nth-child(3),
#mainContainer > .box:nth-child(4) {
  animation-delay: 0.4s;
}

#mainContainer > .box:nth-child(5),
#mainContainer > .box:nth-child(6) {
  animation-delay: 0.6s;
}

/* ----- 푸터 ----- */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 15px 0;
    font-size: 14px;
  }
  
/* --------------------- CSS 끝 --------------------- */

.menu-icon {
  display: none; 
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--white);
}

@media (max-width: 767px) {
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    position: relative;
  }
  .header-left {
    display: flex;
    align-items: center;
  }

  .menu-icon {
    display: block;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--white);
    position: absolute;
    right: 2rem;
  }
  .menu-icon:active {
    transform: scale(0.9);
    transition: transform 0.1s ease;
  }
  #main-nav {
    position: fixed;
    top: 0;
    right: 0; /* 기본 숨김 */
    width: 30%; /* 필요에 따라 조정 가능 (예: 최대 300px) */
    max-width: 300px;
    height: 100vh;
    background-color: var(--white);
    color: var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.5rem 1rem; /* 위쪽 패딩을 늘려서 여유있게 */
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    transform: translateX(100%);
    transition: transform var(--transition-speed) ease-out;
    will-change: transform;
    z-index: 1000;
    margin-top: 0; /* 상단 틈 제거 */
    margin-right: 0;
  }
  #main-nav.nav-active {
    transform: translateX(0);
  }

  #main-nav a.header-link {
    color: var(--primary-color);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
  }

  #overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 999;
  }
  #overlay.active {
    display: block;
  }

  /* 메인 컨테이너를 한 열로 변경 */
  #mainContainer {
    display: block;
    padding: 1rem; /* 필요에 따라 조정 */
    gap: 1rem;
  }
  .box {
    margin-bottom: 1rem;
  }

  #Box1 {
    overflow: hidden;
    padding: 0;
    aspect-ratio: auto !important; /* 혹시 이전 규칙 무효화 */
  }


  #Box1 .factor-image {
    width: 100%;
    height: 100%;           /* 박스 높이를 가득 사용 */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;    /* 비율 유지 + 잘리지 않게 */
    object-position: center;
    display: block;
  }

  #Box2 {
    overflow: hidden;
    display: flex;  
    padding: 0;
    aspect-ratio: auto !important; /* 혹시 이전 규칙 무효화 */
    object-fit: contain;    /* 비율 유지 + 잘리지 않게 */
    object-position: center;
    align-items: center;
  }

  #Box2 .factor-image {
    width: 100%;
    max-width: 100%;
    object-fit: contain;    /* 비율 유지 + 잘리지 않게 */
    object-position: center;
    align-items: center;
    display: block;
  }

  #mainContainer > .box:nth-child(1) { animation-delay: 0.2s; }
  #mainContainer > .box:nth-child(2) { animation-delay: 0.4s; }
  #mainContainer > .box:nth-child(3) { animation-delay: 0.6s; }
  #mainContainer > .box:nth-child(4) { animation-delay: 0.8s; }
  #mainContainer > .box:nth-child(5) { animation-delay: 1.0s; }
  #mainContainer > .box:nth-child(6) { animation-delay: 1.2s; }

}

@media (min-width: 768px) and (max-width: 1023px) {

}

@media (min-width: 1024px) {

}