/* 모든 화면 공통 — 기본 규칙(글자 렌더링 · 전환 곡선 · 브레이크포인트 안내). 헤더 · 푸터는 parts/{파트}.css, 여러 템플릿에 공통인 연출은 여기 */

/* ── 브레이크포인트 ───────────────────────────────────────────────────────
 * 모바일 ~767px / 태블릿 768~1023px / 데스크탑 1024px~  (Tailwind의 md · lg와 같은 값)
 *   모바일 기본으로 쓰고 위로 올라가며 덮는다: `@media (min-width: 768px)`, `@media (min-width: 1024px)`
 *   글자 크기·간격은 구간이 아니라 theme.json의 유동 값(fluid / clamp)으로 잇는다. 구간은 구조가 바뀔 때만 쓴다
 *   (메뉴 접힘, 열 수 변화, 두 단 → 한 단)
 *   커서·호버 연출은 너비가 아니라 `(hover: hover) and (pointer: fine)`으로 가린다(cursor.css)
 * CSS 변수는 미디어 쿼리 안에서 쓸 수 없어서 값을 직접 쓴다. 에디터의 「화면 크기별 숨기기」는 theme.json의 settings.viewport
 * (mobile 767px · tablet 1023px)를 기준으로 하므로, 구간을 바꿀 때는 이 파일의 값과 viewport를 같이 고친다.
 *
 * ── 공통 토큰 ──
 *   --wp--custom--vwc  (theme.json settings.custom) 시안의 --vwc. 1vw이되 1920px에서 멈춘다(min(1vw, 19.2px)). 글자 크기 · 간격 프리셋과 파트 CSS가 같이 쓴다
 *   --thesmc-ease · --thesmc-dur · --thesmc-dur-slow (아래 body) 전환 곡선과 시간. 색 · 간격은 theme.json 프리셋(--wp--preset--*)
 * 주의: 워드프레스 코어의 컬럼 블록은 781px 이하에서 쌓이므로, 컬럼을 쓰면 768~781px(아이패드 세로)에서 어긋난다.
 */

/* ── 글자 렌더링 — 시안과 같은 굵기로 ──────────────────────────────────────────────
 * 맥에서 글자가 더 굵게 그려지는 것을 막는다(윈도우·리눅스는 효과 없음). font-synthesis: none은 웹폰트에 없는 굵기·기울임을
 * 브라우저가 억지로 만들지 못하게 한다 — 우리는 정해진 굵기 파일만 쓴다.
 * 세 속성 모두 상속되므로 body 하나에 둔다 — 에디터는 이 파일의 body 규칙을 캔버스 바탕(.editor-styles-wrapper)으로
 * 옮겨 적용한다. html 규칙은 에디터에서 빠질 수 있다.
 */
body {
  --thesmc-ease: cubic-bezier(
    0.32,
    0.94,
    0.6,
    1
  ); /* 시안의 전환 곡선 — 로고 · 괄호 · 햄버거 · 모바일 패널이 같이 쓴다. 바꿀 때는 여기 한 곳 */
  --thesmc-dur: 0.3s; /* 호버 · 상태 전환의 기본 시간 */
  --thesmc-dur-slow: 0.45s; /* 움직임이 큰 전환(로고 워드마크 · 심볼) */
  --thesmc-brand-size: 30px; /* 로고 심볼 한 변 — 헤더 로고(header.css) · 로딩 화면 심볼(loader.css)이 같이 쓴다. 모바일 30 / 태블릿 32 / 데스크탑 34 */
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  body {
    --thesmc-brand-size: 32px;
  }
}

@media (min-width: 1024px) {
  body {
    --thesmc-brand-size: 34px;
  }
}

/* ── 좌우 패딩(gutter) — 모바일만 시안의 고정값 24px ──
 * theme.json 프리셋은 미디어 쿼리를 쓸 수 없어 여기서 덮는다. 프리셋은 워드프레스가 :root에 인라인으로 출력하므로
 * 로드 순서와 상관없이 이기도록 body에 건다
 */
@media (max-width: 767px) {
  body {
    --wp--preset--spacing--gutter: 24px;
  }
}

/* 더블탭 확대(와 탭 지연)만 끈다. 핀치 확대는 그대로라 접근성에 영향이 없다 */
html {
  touch-action: manipulation;
}

/* ── 카드 커서 — Works · 수상작 카드(parts/works-grid.css)와 Works 상세 관련 프로젝트 썸네일 이미지 위에서 따라다니는 원형 화살표 ──
 * 요소는 global.js 「템플릿 파트: works-grid」가 body에 하나 넣는다. 화면 기준(fixed)이라 카드 가장자리에서도 잘리지 않는다
 * (기존 사이트와 같은 방식). 카드 이미지 위에서만 .is-on. 헤더(z-index 290~300)보다는 아래
 */
.wcard__cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: clamp(58px, calc(5 * var(--wp--custom--vwc)), 78px);
  height: clamp(58px, calc(5 * var(--wp--custom--vwc)), 78px);
  border-radius: var(--wp--preset--border-radius--circle);
  background: var(--wp--preset--color--white);
  color: var(--wp--preset--color--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.4);
  transition:
    opacity var(--thesmc-dur) var(--thesmc-ease),
    transform 0.35s var(--thesmc-ease);
  pointer-events: none;
}

.wcard__cursor.is-on {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.wcard__cursor svg {
  width: 40%;
  height: 40%;
}

@media (hover: none) {
  .wcard__cursor {
    display: none;
  }
}

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

/* ── 원본 링크 화살표 — 원본 링크 블록(thesmc/project-links)이 링크 글자 뒤에 넣는 「↗」 ──
 * Works 상세(.wd-plink) · 뉴스 상세(.nd-src) 공통. 시안 .arr — 영문 글꼴 500, 링크 글자 크기를 따른다. hover 이동은 시안에 없어 추가
 * 링크 글자 · 간격은 각 템플릿 CSS
 */
/* 화살표는 글자 흐름 안에서 마지막 글자 뒤를 따라간다 — 블록이 마지막 글자와 묶어 주고(__tail), 여기서 줄바꿈을 막는다 */
.thesmc-project-links__tail {
  white-space: nowrap;
}

.thesmc-project-links__arrow {
  display: inline-block; /* 글자 흐름(inline) 그대로는 hover 이동(transform)이 먹지 않는다 */
  font-family: var(--wp--preset--font-family--aeonik);
  font-weight: 500;
  transition: transform var(--thesmc-dur) var(--thesmc-ease);
}

/* 링크에 올리면 가리키는 방향(오른쪽 위)으로 살짝 — 뒤로가기 「←」(왼쪽) · 뉴스 첨부 파일 「↓」(아래)와 같은 패턴 */
.thesmc-project-links a:hover .thesmc-project-links__arrow {
  transform: translate(2px, -2px);
}

@media (prefers-reduced-motion: reduce) {
  .thesmc-project-links__arrow {
    transition: none;
  }
}

/* ── 제목 리빌 — 블록 클래스에 `thesmc-reveal`이 있는 제목 (global.js 「제목 리빌」) ──
 * 데스크탑 · 태블릿(768px~)은 글자 단위, 모바일(~767px)은 줄 단위로 마스크 아래에서 올라온다. 조각은 스크립트가 넣는다.
 * 스크립트가 조각을 다 넣기 전(.is-ready 전)에는 숨겨 둔다 — 첫 화면 제목이 보였다가 사라지는 번쩍임을 막는다.
 * 스크립트가 안 돌아도 3초 뒤에는 보인다. 에디터(.is-root-container)와 움직임 줄이기에서는 숨기지 않는다
 */
@media (prefers-reduced-motion: no-preference) {
  .wp-site-blocks:not(.is-root-container) .thesmc-reveal:not(.is-ready) {
    opacity: 0;
    animation: thesmc-reveal-failsafe 0s linear 3s forwards;
  }
}

@keyframes thesmc-reveal-failsafe {
  to {
    opacity: 1;
  }
}

/* 화면 낭독기용 원문 — 글자 조각(aria-hidden) 대신 이것을 읽는다 */
.thesmc-reveal__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  user-select: none; /* 글을 복사할 때 숨김 텍스트가 같이 붙어 두 번 나오지 않게 */
}

/* 글자 단위: 단어 하나가 마스크. 글자가 inline-block이어야 따로 움직인다.
 * clip 영역은 아래로만 0.22em 넓힌다("g"처럼 내려가는 획이 잘리지 않게). 위 · 옆은 넉넉히 — 글자는 아래에서만 들어온다 */
.thesmc-reveal__w {
  display: inline-block;
  white-space: nowrap; /* 단어 중간에서 줄바꿈하지 않는다 */
  clip-path: inset(-0.5em -0.3em -0.22em -0.3em);
}

.thesmc-reveal__c {
  display: inline-block;
}

/* 줄 단위(모바일): 줄(<br>로 나뉜 곳)마다 마스크 상자와 움직이는 글 */
.thesmc-reveal__lnbox {
  display: block;
  clip-path: inset(-0.5em -0.3em -0.22em -0.3em);
}

.thesmc-reveal__ln {
  display: block;
}
