/* ====== CSS 변수 & 기본 설정 ====== */
:root {
  --light-gray: #ccc;
  --base-font: 'Noto Sans KR', sans-serif;
  --point-font: 'Noto Sans KR', sans-serif;
  /* 3항목 기준: 선택 항목 중앙 + 위·아래 이웃이 슬롯 안에 보이도록 5칸 */
  --history-year-slot-h: 240px;
  --history-year-item-h: 48px;
  --history-year-motion: 500ms ease-in-out;
}

/* ====== 연혁 페이지 공통 래퍼 ====== */
.history-wrapper {
  position: relative;
  margin: 50px 0 100px;
  min-height: 100%;
}

body:has(.history-layout) {
  overflow-y: scroll;
}

/* ====== PC 레이아웃: 데이터 영역 중앙 정렬 ======
   [여백 1fr][연도 슬롯][데이터][여백 1fr]
   → 데이터 열의 중심 = 콘텐츠 영역 수평 중앙
*/
.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 560px) minmax(0, 1fr);
  width: 90%;
  max-width: 1200px;
  margin: 24px auto 0;
  position: relative;
  align-items: start;
  column-gap: 0;
}

.history-year-rail {
  grid-column: 1;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: stretch;
  padding: 0 20px 8px 12px;
  box-sizing: border-box;
  gap: 2px;
}

.history-year-hint {
  flex: 0 0 auto;
  width: 28px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #4e61aa;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.history-year-hint:hover,
.history-year-hint:focus-visible {
  opacity: 1;
  outline: none;
}

.history-year-hint:disabled {
  opacity: 0.15;
  cursor: default;
}

.history-year-slot {
  position: relative;
  width: max-content;
  min-width: 120px;
  height: var(--history-year-slot-h);
  overflow: hidden;
  display: flex;
  justify-content: flex-end;
  /* 가장자리 페이드로 위·아래 추가 항목이 있음을 암시 */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 14%,
    #000 86%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 14%,
    #000 86%,
    transparent 100%
  );
}

.history-year-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  will-change: transform;
  transform: translateY(var(--year-offset, 0px));
  transition: transform var(--history-year-motion);
}

.history-year-item {
  box-sizing: border-box;
  flex: 0 0 var(--history-year-item-h);
  height: var(--history-year-item-h);
  margin: 0;
  padding: 0 12px 0 0;
  border: none;
  border-right: 3px solid transparent;
  background: transparent;
  color: #9a9a9a;
  font-size: 1.05rem;
  font-weight: 500;
  font-family: var(--base-font);
  line-height: 1;
  cursor: pointer;
  text-align: right;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  opacity: 0.45;
  transition:
    color var(--history-year-motion),
    opacity var(--history-year-motion),
    font-size var(--history-year-motion),
    font-weight var(--history-year-motion),
    border-color var(--history-year-motion);
}

.history-year-item:hover,
.history-year-item:focus-visible {
  color: #4e61aa;
  opacity: 0.75;
  outline: none;
}

.history-year-item.is-active {
  color: #000000;
  font-size: 32px;
  font-weight: 700;
  opacity: 1;
  border-right-color: #4e61aa;
}

/* '개발이력' 긴 라벨: 한 줄 유지, 슬롯 너비는 max-content로 확장 */
.history-year-item[data-year="DEV_TEAM"] {
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* ====== 연혁 타임라인 영역 (중앙 데이터 열) ====== */
.history-wrap {
  grid-column: 2;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 20px 12px 40px 40px;
  box-sizing: border-box;
  min-height: 240px;
}

.history-year-panel {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.history-year-panel.is-active {
  opacity: 1;
  transform: translateY(0);
}

.history-year-panel[hidden] {
  display: none !important;
}

.history-wrap > .history-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--light-gray);
  z-index: 0;
}

.history-right {
  position: relative;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  text-align: left;
  left: 0;
}

.history-content {
  font-size: 16px;
  color: #333;
  line-height: 1.5;
  font-weight: normal;
  display: block;
}

.month {
  margin-bottom: 10px;
  line-height: 1.6;
  font-weight: 400;
  text-align: left;
}

.month strong {
  font-weight: 600;
  color: #4e61aa;
  font-family: var(--point-font);
}

.history-dev-item {
  padding-left: 0;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --history-year-motion: 0.01ms linear;
  }

  .history-year-panel,
  .history-year-panel.is-active {
    transition: none;
  }
}

/* ====== 반응형 ====== */
@media (max-width: 768px) {
  :root {
    --history-year-slot-h: 220px;
    --history-year-item-h: 44px;
  }

  .history-layout {
    grid-template-columns: 1fr;
    width: 94%;
    margin-top: 16px;
  }

  .history-year-rail,
  .history-wrap {
    grid-column: 1;
  }

  .history-year-rail {
    align-items: flex-start;
    padding: 0 4px 8px;
  }

  .history-year-slot {
    justify-content: flex-start;
  }

  .history-year-list {
    align-items: flex-start;
  }

  .history-year-item {
    text-align: left;
    justify-content: flex-start;
    border-right: none;
    border-left: 3px solid transparent;
    padding: 0 0 0 12px;
  }

  .history-year-item.is-active {
    font-size: 28px;
    border-left-color: #4e61aa;
  }

  .history-wrap {
    padding: 8px 8px 24px 24px;
  }

  .history-wrap > .history-line {
    display: none;
  }

  .history-content {
    font-size: 0.9rem;
  }
}
