/* =========================================================
   History (history.html 전용)
   - 메인과 같은 디자인 시스템: off-white / white, black·gray 타이포, 넓은 여백, 얇은 divider
   - 세로 타임라인: 연도가 바뀌는 지점은 큰 숫자 + 얇은 라인
   - 스크롤 진행에 따라 타임라인 선이 채워지고, 화면 중앙을 지나는 연도가 active
   - 처음 등장한 항목(.is-new)은 진하게 + Primary 짧은 선, 이어지는 항목은 gray
   ========================================================= */

/* ----- Header: Company > 연혁 현재 페이지 표시 ----- */
.gnb__link.is-current::after {
  transform: scaleX(1);
}

.mega__list a[aria-current="page"] {
  font-weight: 500;
  color: var(--c-black);
  text-decoration-color: currentColor;
}

/* ----- Page ----- */
.hist {
  --c-blue: #2557ff;
  --hist-bg: #f3f4f5;
  --hist-line: #e8e8e8;
  --hist-carried: #6f6f6f;
  --hist-year-idle: #8f8f8f;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-roll: cubic-bezier(0.76, 0, 0.18, 1);

  position: relative;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--c-black);
  background-color: var(--c-white);
  /* 오른쪽 가장자리로 빠지는 분기 레일만 잘라냄 (clip 은 sticky 연도에 영향 없음) */
  overflow-x: clip;
}

/* ----- Background: 추상화된 물류 레일 -----
   섹션 배경색 위 / 콘텐츠 아래 (z-index 1 ↔ 콘텐츠 2).
   레일은 콘텐츠가 없는 여백(헤드 오른쪽, 타임라인 오른쪽 여백, 하단 여백)으로만 지나감 */
.hist__bg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.hist__eyebrow,
.hist__title,
.hist__range,
.hist__timeline {
  position: relative;
  z-index: 2;
}

.hist-rail {
  fill: none;
  stroke: rgba(17, 17, 17, 0.13);
}

.hist-roller {
  stroke: rgba(17, 17, 17, 0.07);
  stroke-width: 1;
}

.hist-sensor {
  stroke: rgba(17, 17, 17, 0.28);
  stroke-width: 1;
  stroke-dasharray: 2 2;
  opacity: 0;
  transition: opacity 0.6s ease, stroke 0.3s ease;
}

.hist-node {
  fill: var(--c-white);
  stroke: rgba(17, 17, 17, 0.32);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.6s ease, fill 0.3s ease, stroke 0.3s ease;
}

.hist-node.is-shown,
.hist-sensor.is-shown {
  opacity: 1;
}

/* point 가 분기점을 지나는 순간에만 Primary */
.hist-node.is-on {
  fill: var(--c-blue);
  stroke: var(--c-blue);
}

.hist-sensor.is-on {
  stroke: var(--c-blue);
}

.hist-point {
  fill: rgba(17, 17, 17, 0.55);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hist-point.is-shown {
  opacity: 1;
}

/* ----- Head ----- */
.hist__head {
  padding: 72px var(--gutter) 56px;
  background-color: var(--hist-bg);
}

.hist__eyebrow {
  display: flex;
  gap: 10px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.6;
  color: var(--c-text-muted);
}

.hist__eyebrow-current {
  color: var(--c-black);
}

.hist__title {
  margin-top: 28px;
  font-size: clamp(32px, 8.6vw, 44px);
  font-weight: 300;
  line-height: 1.22;
  letter-spacing: -0.035em;
  word-break: keep-all;
}

.hist__line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.hist__line > span {
  display: block;
  transition: transform 1.1s var(--ease-roll);
}

.hist__line:nth-child(2) > span {
  font-weight: 500;
  transition-delay: 90ms;
}

.hist__range {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--hist-line);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--c-text-muted);
}

/* ----- Timeline ----- */
.hist__body {
  padding: 24px var(--gutter) 120px;
}

.hist__timeline {
  --track-x: 0px;
  --item-pad: 28px;

  position: relative;
}

.hist__list {
  list-style: none;
}

/* 세로 기준선 + 스크롤 진행만큼 채워지는 선 */
.hist__track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--track-x);
  width: 1px;
  background-color: rgba(17, 17, 17, 0.12);
}

.hist__track-fill {
  position: absolute;
  inset: 0;
  background-color: var(--c-black);
  transform: scaleY(var(--hist-progress, 0));
  transform-origin: top center;
}

.hist__item {
  position: relative;
  padding: 44px 0 52px var(--item-pad);
  border-top: 1px solid var(--hist-line);
}

.hist__item:first-child {
  border-top: 0;
}

/* 연도 지점 표시: 기준선 위의 작은 점 */
.hist__item::before {
  content: "";
  position: absolute;
  left: calc(var(--track-x) - 3px);
  top: calc(44px + 0.42em);
  width: 7px;
  height: 7px;
  border: 1px solid rgba(17, 17, 17, 0.35);
  border-radius: 50%;
  background-color: var(--c-white);
  font-size: clamp(34px, 9.4vw, 44px);
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.hist__item.is-active::before {
  border-color: var(--c-blue);
  background-color: var(--c-blue);
}

.hist__year {
  font-size: clamp(34px, 9.4vw, 44px);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--hist-year-idle);
  transition: color 0.5s ease;
}

.hist__item.is-active .hist__year {
  color: var(--c-black);
}

.hist__entries {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  list-style: none;
}

.hist__entries li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--hist-carried);
  word-break: keep-all;
}

/* 항목 앞 짧은 선: 이어지는 항목은 gray, 새로 등장한 항목은 Primary */
.hist__entries li::before {
  content: "";
  flex: none;
  width: 12px;
  height: 1px;
  background-color: rgba(17, 17, 17, 0.25);
  transform: translateY(-0.3em);
}

.hist__entries li.is-new {
  font-weight: 500;
  color: var(--c-black);
}

.hist__entries li.is-new::before {
  background-color: var(--c-blue);
}

/* ----- Reveal (html.js 일 때만 초기 숨김) ----- */
html.js .hist:not(.is-ready) .hist__line > span {
  transform: translateY(110%);
}

html.js .hist__entries li {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out), color 0.4s ease;
}

html.js .hist__item.is-in .hist__entries li {
  opacity: 1;
  transform: none;
}

html.js .hist__item.is-in .hist__entries li:nth-child(2) { transition-delay: 60ms; }
html.js .hist__item.is-in .hist__entries li:nth-child(3) { transition-delay: 120ms; }
html.js .hist__item.is-in .hist__entries li:nth-child(4) { transition-delay: 180ms; }

/* ----- Tablet ----- */
@media (min-width: 768px) {
  .hist__head {
    padding: 112px var(--gutter) 72px;
  }

  .hist__title {
    font-size: clamp(48px, 6.6vw, 60px);
  }

  .hist__range {
    margin-top: 64px;
  }

  .hist__body {
    padding-top: 40px;
    padding-bottom: 160px;
  }

  /* 연도(왼쪽) | 기준선 | 항목(오른쪽) */
  .hist__timeline {
    --track-x: 44%;
    --item-pad: 0px;
  }

  .hist__item {
    display: grid;
    grid-template-columns: var(--track-x) 1fr;
    padding: 56px 0 72px;
  }

  .hist__item::before {
    top: calc(56px + 0.42em);
    font-size: 42px;
  }

  .hist__year {
    font-size: 42px;
  }

  .hist__entries {
    align-content: start;
    margin-top: 0;
    padding-top: 10px;
    padding-left: 48px;
  }

  .hist__entries li {
    font-size: 16px;
  }
}

/* ----- Desktop ----- */
@media (min-width: 1024px) {
  .hist__head {
    padding: 16vh var(--gutter) 10vh;
  }

  .hist__title {
    font-size: clamp(52px, 4.8vw, 80px);
    line-height: 1.18;
  }

  .hist__range {
    margin-top: 12vh;
  }

  .hist__body {
    padding-top: 56px;
    padding-bottom: 200px;
  }

  .hist__timeline {
    --track-x: 42%;
  }

  .hist__item {
    padding: 72px 0 112px;
  }

  .hist__item::before {
    top: calc(72px + 0.42em);
    font-size: clamp(56px, 5.2vw, 88px);
  }

  /* 큰 연도가 항목을 읽는 동안 화면에 머무름 */
  .hist__year {
    position: sticky;
    top: calc(var(--header-h) + 40px);
    align-self: start;
    font-size: clamp(56px, 5.2vw, 88px);
  }

  .hist__entries {
    padding-top: 16px;
    padding-left: 72px;
  }

  .hist__entries li {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hist *,
  .hist *::before {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
