/* ==========================================================
   폰트 미리보기 페이지 (index.html)
   레이아웃은 피그마 원본(1512px) 기준, 데스크탑 우선
   ========================================================== */

/* ---------- 공통 요소 ---------- */
.rule {
  height: 1px;
  background: var(--main);
}

.section-label {
  font-size: var(--fs-label);
  line-height: 1.3;
  font-weight: 400;
}

.section {
  padding-block: 48px;
}

.section.info {
  padding-block: 48px;
}

/* ---------- 상단 고정 바 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding-inline: var(--gutter);
  background: var(--main);
  color: var(--white);
  font-size: var(--fs-meta);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__mark {
  width: 15px;
  height: 16px;
  display: block;
}

.topbar__nav {
  display: flex;
  gap: 4px;
  color: var(--sub);
}

.topbar__nav a:hover {
  color: var(--white);
}

/* ---------- Hero ---------- */
.hero {
  background: var(--sub);
  padding-top: 28px;
  padding-bottom: 96px;
}

.hero__title {
  font-size: var(--fs-head);
  font-weight: 400;
  line-height: 1.3;
}

.hero__headline {
  font-family: var(--font-display);
  color: var(--main);
  font-size: clamp(30px, 8.2vw, 126px);
  line-height: 1.32;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  padding-top: 0.9em;
}

/* CMS 실시간 갱신으로 텍스트가 바뀔 때 팝업 대신 크로스페이드로 전환한다. */
.hero__title,
.hero__headline {
  transition: opacity 0.15s ease;
}

.hero__title.is-fading,
.hero__headline.is-fading {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hero__title,
  .hero__headline {
    transition: none;
  }
}

/* ---------- 서체 소개 / 서체 정보 ---------- */
.info__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--col-gap);
}

.info__heading {
  font-size: var(--fs-body);
  padding-bottom: 12px;
}

.info__col .rule {
  margin-bottom: 20px;
}

.info__body {
  line-height: 1.8;
  word-break: keep-all;
}

.info__table {
  width: 100%;
  border-collapse: collapse;
}

.info__table th,
.info__table td {
  text-align: left;
  font-weight: 400;
  vertical-align: top;
  padding-bottom: 10px;
}

.info__table th {
  width: 130px;
}

/* ---------- 타이핑 ---------- */
.typing__rows {
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.typing__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--col-gap);
}

/* 그리드 칸이 내용 너비만큼 벌어져 가로 스크롤이 생기지 않도록 */
.typing__box {
  min-width: 0;
}

.typing__row--split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.typing__meta {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: var(--fs-meta);
  padding-bottom: 8px;
}

.typing__id {
  min-width: 48px;
}

.typing__control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.typing__control-value {
  min-width: 44px;
  white-space: nowrap;
}

/* 얇은 핑크 슬라이더 */
.typing__control input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 68px;
  height: 1px;
  background: var(--main);
  cursor: pointer;
}

.typing__control input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--main);
  cursor: pointer;
}

.typing__control input[type='range']::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: none;
  border-radius: 50%;
  background: var(--main);
  cursor: pointer;
}

.typing__control input[type='range']::-moz-range-track {
  background: var(--main);
  height: 1px;
}

/* 글자가 들어가는 영역: 높이를 내용에 맡기고, JS가 위아래 여백을 계산해
   폰트 크기를 키워도 획이 잘리지 않게 한다. */
.typing__text {
  font-family: var(--font-display);
  color: var(--sub);
  text-align: center;
  outline: none;
  cursor: text;
  word-break: keep-all;
  overflow-wrap: break-word;
  margin-top: 24px;
  transition: color 0.15s ease;
}

.typing__text:focus {
  color: var(--main);
}

/* ---------- 글리프 ---------- */
.glyphs__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 12px;
}

.glyphs__search {
  position: relative;
  font-size: var(--fs-meta);
}

.glyphs__search input {
  width: 260px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--main);
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: var(--ink);
  outline: none;
}

.glyphs__search input::placeholder {
  color: rgba(17, 17, 17, 0.4);
}

.glyphs__search input.is-miss {
  border-bottom-color: #e00;
}

.glyphs__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: start;
}

.glyphs__preview {
  position: sticky;
  top: 64px;
}

.glyphs__preview-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 215px;
  padding: 16px 0;
}

.glyphs__code {
  position: absolute;
  left: 0;
  top: 16px;
  color: var(--main);
  font-size: var(--fs-body);
}

.glyphs__big {
  font-family: var(--font-display);
  font-size: 150px;
  line-height: 1.1;
}

.glyphs__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px;
  background: var(--main);
  border: 1px solid var(--main);
}

.glyphs__cell {
  background: var(--white);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}

.glyphs__cell:hover,
.glyphs__cell.is-active {
  background: var(--sub);
}

.glyphs__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  font-size: var(--fs-meta);
}

.glyphs__reset {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: var(--main);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.glyphs__count {
  color: rgba(17, 17, 17, 0.5);
}

/* ---------- 영상 ---------- */
/* 페이지 전체가 공유하는 12칼럼 시스템.
   헤더 줄과 캡션 줄이 같은 칼럼을 쓰므로 세로선이 그대로 맞는다. */
.head-row,
.caption-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  align-items: baseline;
}

.col-label { grid-column: 1 / 3; }
.col-a { grid-column: 3 / 7; }
.col-b { grid-column: 7 / 10; }

.col-end {
  grid-column: 10 / -1;
  text-align: right;
  white-space: nowrap;
}

.head-row {
  font-size: var(--fs-label);
  padding-bottom: 20px;
}

.caption-row {
  padding-top: 16px;
  font-size: var(--fs-meta);
}



.video__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(17, 17, 17, 0.5);
  font-size: var(--fs-meta);
  overflow: hidden;
}

.video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- 사용 예시 ---------- */
/* 포스터/이미지가 아직 없을 때 쓰는 공용 플레이스홀더.
   페이지마다 --key / --key-bg 만 바꾸면 그대로 재사용된다. */
.placeholder {
  --key: var(--main);
  --key-bg: var(--sub);
  flex: 1 1 auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  min-height: 420px;
  padding: 64px 24px;
  background: var(--key-bg);
  color: var(--key);
  text-align: center;
}

.placeholder__face {
  font-size: clamp(48px, 6.5vw, 96px);
  line-height: 1;
}

.placeholder__text {
  font-size: clamp(16px, 1.6vw, 24px);
  line-height: 1.6;
}

/* . > .. > ... 순환. 세 점을 각각 두고 opacity만 바꿔 자리 이동이 없다 */
.placeholder__dots span:nth-child(2),
.placeholder__dots span:nth-child(3) {
  animation-duration: 1.5s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.placeholder__dots span:nth-child(2) {
  animation-name: placeholder-dot-2;
}

.placeholder__dots span:nth-child(3) {
  animation-name: placeholder-dot-3;
}

@keyframes placeholder-dot-2 {
  0% { opacity: 0; }
  33.34% { opacity: 1; }
}

@keyframes placeholder-dot-3 {
  0% { opacity: 0; }
  66.67% { opacity: 1; }
}

/* ---------- 로딩 화면 ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--white);
  color: var(--main);
  text-align: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-screen__face {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
  white-space: nowrap;
}

/* 괄호도 나머지 특수기호처럼 Noto Sans KR로 그린다 (Atlas Grotesk는 이 기호들을 아예 지원하지 않는다). */
.loading-screen__face .paren {
  font-family: 'Noto Sans KR', sans-serif;
}

.loading-screen__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-body);
  line-height: 1.4;
}

/* 三을 하나씩 늘려가며 달려가는 잔상처럼 보이게 한다. 점 애니메이션과 같은 원리. */
.loading-trail span:nth-child(2) { animation-name: trail-2; }
.loading-trail span:nth-child(3) { animation-name: trail-3; }
.loading-trail span:nth-child(4) { animation-name: trail-4; }
.loading-trail span:nth-child(5) { animation-name: trail-5; }

.loading-trail span:nth-child(2),
.loading-trail span:nth-child(3),
.loading-trail span:nth-child(4),
.loading-trail span:nth-child(5) {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trail-2 { 0% { opacity: 0; } 20% { opacity: 1; } }
@keyframes trail-3 { 0% { opacity: 0; } 40% { opacity: 1; } }
@keyframes trail-4 { 0% { opacity: 0; } 60% { opacity: 1; } }
@keyframes trail-5 { 0% { opacity: 0; } 80% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .placeholder__dots span,
  .loading-trail span,
  .footer__mark span {
    animation: none;
  }

  .footer__mark span:nth-child(2) {
    display: none;
  }
}

.usage__frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 96px;
  background: var(--sub);
}

.usage__frame--empty {
  padding: 0;
  background: transparent;
}

.usage__frame img {
  max-height: 640px;
  width: auto;
}

.usage__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--main);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 16px;
}

.usage__nav--prev { left: 24px; }
.usage__nav--next { right: 24px; }

.usage__nav:hover { color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer {
  padding-top: 24px;
  padding-bottom: 40px;
  margin-top: 40px;
  font-size: var(--fs-meta);
}

.site-footer .rule {
  background: #000;
  margin-bottom: 24px;
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px var(--col-gap);
  align-items: start;
}

/* 1행: TAP / 국문 소개, 2행: 링크 / 영문 소개 — 링크와 영문이 같은 줄에서 시작한다 */
.footer__brand { grid-column: 1 / 2; grid-row: 1; }
.footer__kr { grid-column: 2 / 7; grid-row: 1; }
.footer__links { grid-column: 1 / 2; grid-row: 2; }
.footer__en { grid-column: 2 / 7; grid-row: 2; }

.footer__kr {
  line-height: 1.5;
}
.footer__en {
  line-height: 1.48;
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.footer__links a:hover {
  color: var(--main);
}

/* 마크는 카피라이트 위에 가운데 정렬, 블록 전체는 오른쪽 끝에 붙는다 */
.footer__end {
  grid-column: 8 / -1;
  grid-row: 1 / 3;
  width: fit-content;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0px;
  height: 100%;
  text-align: center;
}

/* 두 포즈를 같은 칸에 겹쳐 두고 번갈아 보여준다 */
.footer__mark {
  display: grid;
  justify-items: center;
  margin-top: 1.3em; /* 한 줄 정도 아래로 */
}

.footer__mark span {
  grid-area: 1 / 1;
  white-space: pre;
  line-height: 1.3;
  animation: footer-mark-b 1.1s steps(1, end) infinite;
}

.footer__mark span:nth-child(1) {
  animation-name: footer-mark-a;
}

@keyframes footer-mark-a {
  0% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes footer-mark-b {
  0% { opacity: 0; }
  50% { opacity: 1; }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .section {
    padding-block: 40px;
  }

  .hero {
    padding-bottom: 40px;
  }

  .hero__headline {
    padding-top: 0.6em;
  }

  .info__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .info__table th {
    width: 96px;
  }

  .typing__row--split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .typing__meta {
    gap: 14px;
    flex-wrap: wrap;
  }

  /* 좁은 화면에서는 큰 글자가 넘치지 않도록 음절 단위로도 끊는다 */
  .typing__text {
    word-break: break-word;
  }

  .typing__control input[type='range'] {
    width: 52px;
  }

  .glyphs__head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .glyphs__search input {
    width: 100%;
  }

  .glyphs__layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .glyphs__preview {
    position: static;
  }

  .glyphs__preview-body {
    min-height: 140px;
  }

  .glyphs__big {
    font-size: 96px;
  }

  .glyphs__grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .glyphs__cell {
    font-size: 18px;
  }

  /* 좁은 화면에서는 한 줄에 하나씩 쌓는다 */
  .head-row,
  .caption-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .col-label,
  .col-a,
  .col-b,
  .col-end {
    grid-column: 1 / -1;
  }

  .col-end {
    text-align: left;
  }

  .usage__frame {
    padding: 40px 32px;
  }

  .usage__frame img {
    max-height: 420px;
  }

  .usage__nav {
    font-size: 24px;
    padding: 4px 8px;
  }

  .usage__nav--prev { left: 4px; }
  .usage__nav--next { right: 4px; }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .footer__brand,
  .footer__kr,
  .footer__links,
  .footer__en,
  .footer__end {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .footer__links {
    flex-direction: row;
    gap: 16px;
  }

  .footer__end {
    width: 100%;
    margin-left: 0;
    height: auto;
    align-items: center;
    padding-top: 8px;
  }

  .placeholder {
    min-height: 280px;
    gap: 24px;
    padding: 48px 16px;
  }
}
