/*
 * ITS 다국어 타이포그래피 애니메이션
 * 모든 규칙은 .its-typo 안에서만 적용되므로 기존 페이지 스타일에 영향을 주지 않습니다.
 *
 * 색상: 기본은 배경 투명 + 주변 글자색 상속(흰/어두운 배경 어디든 어울림).
 *       data-theme="light" | "dark" | "auto" 로 자체 배경을 줄 수도 있습니다.
 */
.its-typo{
  /* 조절용 변수 — 페이지에서 덮어써서 바꿀 수 있습니다 */
  --its-fg: currentColor;
  --its-bg: transparent;
  --its-min-height: 70vh;
  --its-word-size: clamp(28px, 6vw, 76px);   /* 바뀌는 언어 표현 크기 */
  --its-final-size: clamp(96px, 22vw, 240px); /* 마지막 ITS 크기 */
  --its-font: "Geist", "Spoqa Han Sans Neo", "Noto Sans KR", "Segoe UI", "Noto Sans", system-ui, -apple-system,
    "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Sans", "Yu Gothic", "PingFang SC", "Microsoft YaHei",
    "Microsoft JhengHei", "Nirmala UI", "Leelawadee UI", "Myanmar Text", "Khmer UI", "Lao UI", "Ebrima", sans-serif;
  --its-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--its-min-height);
  padding: clamp(32px, 6vw, 72px) 16px;
  background: var(--its-bg);
  color: var(--its-fg);
  font-family: var(--its-font);
  text-align: center;
  overflow: hidden;
  contain: layout paint;
}
.its-typo[data-theme="light"]{ --its-fg:#171717; --its-bg:#fafafa; }
.its-typo[data-theme="dark"]{ --its-fg:#ededed; --its-bg:#0a0a0a; }
@media (prefers-color-scheme: dark){ .its-typo[data-theme="auto"]{ --its-fg:#ededed; --its-bg:#0a0a0a; } }
@media (prefers-color-scheme: light){ .its-typo[data-theme="auto"]{ --its-fg:#171717; --its-bg:#fafafa; } }

/* 화면 낭독기용 설명 (보이지 않음) */
.its-typo__sr{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* 무대: 언어 표현과 최종 ITS가 같은 칸에 겹쳐 있어 높이가 변하지 않음 → 레이아웃 흔들림 없음 */
.its-typo__stage{
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr); /* 칸 높이 = 무대 높이 (내용 때문에 늘어나지 않음) */
  place-items: center;
  width: min(100%, 1100px);
  height: max(calc(var(--its-word-size) * 2.5), calc(var(--its-final-size) * 1.02));
  font-size: var(--its-word-size);
}
.its-typo__word,
.its-typo__final{ grid-area: 1 / 1; }

.its-typo__word{
  display: block;
  width: 100%;
  margin: 0;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;           /* 아랍 문자·인도계 문자는 자간을 건드리면 글자가 끊어짐 */
  text-wrap: balance;
  overflow-wrap: anywhere;
  unicode-bidi: isolate;
  will-change: transform, opacity;
}
.its-typo__word.is-tight{ letter-spacing: -0.025em; } /* 라틴·키릴·그리스 문자만 자간을 좁힘 */
.its-typo__ghost[hidden],
.its-typo__final[hidden]{ display: none; }

.its-typo__final{
  display: flex;
  justify-content: center;
  font-family: var(--its-font);
  font-size: var(--its-final-size);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  visibility: hidden;
}
.its-typo__final > span{ display: inline-block; will-change: transform, opacity, filter; }

/* 아래쪽: 진행 중에는 언어 이름, 마지막에는 메시지. 높이를 미리 잡아 둬서 흔들리지 않음 */
.its-typo__foot{
  position: relative;
  display: grid;
  place-items: start center;
  width: 100%;
  min-height: 64px;
  margin-top: clamp(12px, 2.4vw, 28px);
}
.its-typo__label,
.its-typo__msg{ grid-area: 1 / 1; }

.its-typo__label{
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 12px/16px var(--its-mono);
  font-variant-numeric: tabular-nums;
  opacity: .5;
}
.its-typo__label .its-typo__lname{ font-family: var(--its-font); }

.its-typo__msg{ display: grid; gap: 10px; visibility: hidden; }
.its-typo__tagline{
  margin: 0;
  font-size: clamp(12px, 1.6vw, 16px);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.its-typo__event{
  margin: 0;
  font: 500 clamp(11px, 1.2vw, 13px)/1.4 var(--its-mono);
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: .55;
}

/* 단계별 표시 */
.its-typo.is-final .its-typo__word,
.its-typo.is-final .its-typo__label{ visibility: hidden; }
.its-typo.is-final .its-typo__final,
.its-typo.is-final .its-typo__msg{ visibility: visible; }

/* 동작 줄이기 설정: 움직임 없이 마지막 화면만 보여줌 (JS가 is-static을 붙임) */
.its-typo.is-static *{ animation: none !important; transition: none !important; }

@media (max-width: 640px){
  .its-typo{ --its-word-size: clamp(24px, 8vw, 40px); --its-final-size: clamp(88px, 30vw, 140px); }
  .its-typo__tagline{ letter-spacing: .12em; }
  .its-typo__event{ letter-spacing: .16em; }
}
