/* ============================================================
   VirusIce — 인트로 이후 UI (내비 · About · History · 푸터 · 스크롤바)
   ============================================================ */
:root {
  --ice: #5fe8ff;
  --ice-2: #14c8b0;
  --ice-grad: linear-gradient(180deg, #5fe8ff 0%, #2fd2f0 45%, #14c8b0 100%);
  --dim: #3c3c42;
  --line: rgba(255, 255, 255, 0.07);
  --f-display: "Inter Tight", "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --f-body: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 68px;
}

/* 기본 스크롤바 숨김 (아래 .sbar 가 대신함 → 생겼다 사라져도 레이아웃 안 밀림) */
html { scrollbar-width: none; -webkit-text-size-adjust: 100%; }
html::-webkit-scrollbar { display: none; width: 0; height: 0; }
html.is-locked { overflow: hidden; }

body { font-family: var(--f-body); font-size: 16px; line-height: 1.6; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: rgba(95, 232, 255, 0.28); color: #fff; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }

/* 인트로 끝나면 서서히 등장하는 것들 */
.nav, .sbar, .hint { opacity: 0; transition: opacity 0.7s ease; }
.is-ready .nav, .is-ready .sbar { opacity: 1; }

/* ============================================================
   NAV — 맨 위: 화면 끝까지 붙은 글래스 바 / 스크롤: 둥근 글래스 알약
   ============================================================ */
.nav {
  position: fixed; z-index: 40; top: 0; left: 50%;
  width: 100%; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 40px);
  border: 1px solid transparent; border-bottom-color: var(--line);
  border-radius: 0;
  background: rgba(10, 10, 13, 0.38);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  transform: translate(-50%, -14px);
  transition:
    opacity 0.7s ease, transform 0.9s var(--ease),
    width 0.7s var(--ease), height 0.7s var(--ease), top 0.7s var(--ease),
    border-radius 0.7s var(--ease), padding 0.7s var(--ease),
    background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}
.is-ready .nav { transform: translate(-50%, 0); }
.is-scrolled .nav {
  --nav-h: 54px;
  top: 14px;
  width: min(640px, calc(100% - 24px));
  padding: 0 8px 0 22px;
  border-radius: 27px;
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    rgba(16, 16, 20, 0.5);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02),
    0 18px 40px -18px rgba(0, 0, 0, 0.8);
}

.nav__logo, .foot__logo {
  font-family: var(--f-display); font-weight: 800; font-size: 17px; letter-spacing: 0.005em; line-height: 1;
}
.nav__logo span, .foot__logo span {
  background: var(--ice-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__links a {
  font-family: var(--f-display); font-weight: 500; font-size: 14px; letter-spacing: 0.01em;
  color: var(--muted); padding: 8px 14px; border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a.is-active { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.nav__links a.nav__cta {
  margin-left: 8px; color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}
.nav__links a.nav__cta:hover { border-color: rgba(95, 232, 255, 0.5); background: rgba(95, 232, 255, 0.08); }

.nav__burger { display: none; position: relative; width: 40px; height: 40px; border-radius: 50%; }
.nav__burger span {
  position: absolute; left: 12px; right: 12px; height: 1.5px; background: var(--ink);
  transition: transform 0.45s var(--ease);
}
.nav__burger span:first-child { top: 16px; }
.nav__burger span:last-child { top: 23px; }
.menu-open .nav__burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-open .nav__burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

/* 모바일 메뉴 */
.menu {
  position: fixed; z-index: 39; top: 76px; left: 12px; right: 12px;
  display: flex; flex-direction: column; padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)), rgba(16, 16, 20, 0.62);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 50px -20px rgba(0, 0, 0, 0.85);
  opacity: 0; transform: translateY(-8px) scale(0.98); transform-origin: top center;
  pointer-events: none; visibility: hidden;
  transition: opacity 0.3s ease, transform 0.45s var(--ease), visibility 0s linear 0.45s;
}
.menu a {
  font-family: var(--f-display); font-weight: 600; font-size: 17px;
  padding: 14px 16px; border-radius: 14px; color: var(--ink);
}
.menu a:active { background: rgba(255, 255, 255, 0.06); }
.menu-open .menu { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }

@media (max-width: 640px) {
  .nav__links { display: none; }
  .nav__burger { display: block; }
  .nav { padding: 0 8px 0 20px; }
  .is-scrolled .nav { padding: 0 6px 0 20px; }
}

/* ============================================================
   HERO 스크롤 힌트
   ============================================================ */
.hint {
  position: absolute; left: 50%; bottom: clamp(24px, 5vh, 44px); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font: 400 10px/1 var(--f-mono); letter-spacing: 0.3em; color: var(--muted);
  pointer-events: none;
}
.hint i { position: relative; width: 1px; height: 38px; background: var(--line); overflow: hidden; }
.hint i::after {
  content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%;
  background: var(--ice); animation: hintDrop 2.2s var(--ease) infinite;
}
@keyframes hintDrop { to { top: 100%; } }
.is-ready .hint { opacity: 1; transition-delay: 0.5s; }
.is-ready.is-scrolled .hint { opacity: 0; transition-delay: 0s; }

/* ============================================================
   SECTIONS 공통
   ============================================================ */
.sec { padding: clamp(110px, 16vw, 200px) 0; scroll-margin-top: 40px; }
.label {
  display: flex; align-items: center; gap: 14px; margin: 0 0 clamp(28px, 4vw, 44px);
  font: 400 11px/1 var(--f-mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.label b { font-weight: 400; color: var(--ice); }
.label::after { content: ""; width: 44px; height: 1px; background: rgba(255, 255, 255, 0.14); }
.sec__title {
  margin: 0 0 clamp(40px, 6vw, 72px);
  font-family: var(--f-display); font-weight: 800; font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.05; letter-spacing: -0.035em; word-break: keep-all;
}

/* ============================================================
   ABOUT — 스크롤할수록 단어가 켜짐 (--a: 0 → 1, JS가 넣어줌)
   ============================================================ */
.lit {
  margin: 0; max-width: 22em;
  font-family: var(--f-body); font-weight: 650;
  font-size: clamp(27px, 4.4vw, 56px); line-height: 1.34; letter-spacing: -0.035em;
  word-break: keep-all;
}
.lit .w {
  --a: 0;
  display: inline-block;
  opacity: calc(0.12 + 0.88 * var(--a));
  transform: translateY(calc((1 - var(--a)) * 0.08em));
  filter: blur(calc((1 - var(--a)) * 1.5px));
}
.lit em { font-style: normal; }
/* 강조 단어: 처음엔 흰 글자 → 켜지면 글자색이 빠지면서 얼음 그라데이션이 드러남 */
.lit .w.hl {
  background: var(--ice-grad); -webkit-background-clip: text; background-clip: text;
  color: var(--ink); transition: color 0.5s ease;
}
.lit .w.hl.is-on { color: transparent; }

/* ============================================================
   HISTORY — 왼쪽 바에 스크롤 따라 불이 차오름
   ============================================================ */
.tl {
  --rail: clamp(30px, 6vw, 72px);     /* 바 ↔ 내용 간격 */
  --bar-x: clamp(4px, 1.2vw, 12px);   /* 바 위치 */
  position: relative; list-style: none; margin: 0; padding: 0 0 0 var(--rail);
}
.tl__bar {
  position: absolute; left: var(--bar-x); top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, 0.08);
}
.tl__fill {
  position: absolute; left: 0; top: 0; width: 100%; height: 0;
  background: linear-gradient(180deg, rgba(95, 232, 255, 0) 0%, var(--ice) 18%, var(--ice-2) 100%);
  box-shadow: 0 0 10px rgba(95, 232, 255, 0.45);
}
/* 차오르는 끝부분: 작게 빛나는 머리 */
.tl__fill::after {
  content: ""; position: absolute; left: 50%; bottom: -3px; width: 5px; height: 5px;
  transform: translateX(-50%); background: #dffbff;
  box-shadow: 0 0 8px 2px rgba(95, 232, 255, 0.9), 0 0 26px 6px rgba(20, 200, 176, 0.35);
  opacity: var(--head, 0); transition: opacity 0.3s;
}

.tl__item {
  position: relative;
  display: grid; grid-template-columns: minmax(96px, 200px) 1fr; gap: 24px;
  padding: clamp(26px, 3.4vw, 38px) 0;
  border-bottom: 1px solid var(--line);
}
.tl__item:first-child { border-top: 1px solid var(--line); }
/* 노드: 얼음 결정 같은 작은 마름모 */
.tl__item::before {
  content: ""; position: absolute;
  top: calc(clamp(26px, 3.4vw, 38px) + 0.5 * clamp(30px, 4vw, 48px) - 4px);
  left: calc(var(--bar-x) - var(--rail) - 3.5px);
  width: 8px; height: 8px; transform: rotate(45deg);
  background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.22);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}
.tl__item.is-on::before {
  background: var(--ice); border-color: var(--ice);
  box-shadow: 0 0 0 4px rgba(95, 232, 255, 0.12), 0 0 14px rgba(95, 232, 255, 0.6);
}
.tl__year {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -0.03em;
  color: var(--dim); transition: color 0.5s ease;
}
.tl__item.is-on .tl__year { color: var(--ink); }
.tl__item h3 {
  margin: 2px 0 6px; font-family: var(--f-body); font-weight: 650;
  font-size: clamp(18px, 2vw, 23px); letter-spacing: -0.025em; word-break: keep-all;
  color: rgba(236, 236, 238, 0.45); transition: color 0.5s ease;
}
.tl__item p { margin: 0; color: var(--muted); word-break: keep-all; opacity: 0.6; transition: opacity 0.5s ease; }
.tl__item.is-on h3 { color: var(--ink); }
.tl__item.is-on p { opacity: 1; }

@media (max-width: 640px) {
  .tl__item { grid-template-columns: 1fr; gap: 10px; }
}

/* ============================================================
   FOOTER — 한 줄짜리
   ============================================================ */
.foot { border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); }
.foot__row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  font: 400 11.5px/1.4 var(--f-mono); letter-spacing: 0.04em; color: var(--muted);
}
.foot__logo { font-size: 14px; color: var(--ink); }
.foot__links { display: flex; gap: 18px; }
.foot__links a { transition: color 0.2s; }
.foot__links a:hover { color: var(--ink); }
@media (max-width: 640px) {
  .foot__row { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   커스텀 스크롤바 — 오른쪽 끝에 딱 붙은 회색 네모
   ============================================================ */
.sbar {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: 12px;  /* 잡기 쉬운 히트 영역 */
  touch-action: none;
}
.sbar.is-off { display: none; }
.sbar__thumb {
  position: absolute; top: 0; right: 0; width: 5px; height: 40px;
  background: #55555b; border-radius: 0;
  transition: width 0.18s ease, background 0.18s ease;
  will-change: transform;
}
.sbar:hover .sbar__thumb, .sbar.is-drag .sbar__thumb { width: 8px; background: #85858c; }
.is-dragging, .is-dragging * { user-select: none !important; -webkit-user-select: none !important; cursor: default; }
@media (hover: none) {
  .sbar { pointer-events: none; }   /* 터치 기기에선 표시만 */
}

/* 리플레이 버튼: 인트로 끝난 뒤에만 페이드인 / 누르면(=is-ready 빠짐) 페이드아웃, 그동안 클릭 불가
   스크롤 내려도 숨김 */
.controls { opacity: 0; pointer-events: none; transition: opacity 0.45s ease; }
.is-ready:not(.is-scrolled) .controls { opacity: 1; pointer-events: auto; transition: opacity 0.7s ease 0.35s; }

/* 새로고침 복원 순간엔 전환 효과 전부 끄기 (바로 그 상태로 보이게) */
.is-restoring *, .is-restoring *::before, .is-restoring *::after { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .hint i::after { animation: none; }
  .lit .w { transform: none; filter: none; }
}
