/* =========================================================
   공용 스타일시트 — 모든 페이지(홈 · 404, 한/영)가 함께 쓴다.
   페이지별 스타일은 9번(홈)과 10번(404) 섹션에만 둔다.
   ========================================================= */

/* ============ 1. 폰트 ============ */
@font-face {
  font-family: 'Pretendard Variable';
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url('/PretendardVariable-1.3.9.woff2') format('woff2-variations');
}

/* ============ 2. 색 · 크기 토큰 ============ */
:root {
  --bg: #f0ede8;
  --text: #2a2520;
  --text-muted: #686058;
  --card-bg: #f7f4f0;

  /* nav: 본문 배경보다 살짝 밝게 띄우고 경계선을 강화 */
  --nav-bg: rgba(250,248,245,0.82);
  --nav-border: rgba(90,75,60,0.18);

  --border: rgba(90,75,60,0.1);

  /* --focus: 반대 테마의 --bg 값을 그대로 쓴다.
     라이트 모드 → 다크 테마의 --bg(#1a1a1a). */
  --focus: #1a1a1a;

  --transition: 0.35s cubic-bezier(0.4,0,0.2,1);

  /* 타입 스케일 — 이 밖의 크기는 만들지 않는다.
     --fs-hero 는 "szngjzn1.com" 12글자가 320px 화면에도 한 줄로 들어가는 크기 */
  --fs-hero: clamp(2.4rem, 13vw, 8rem);
  --fs-h2:   clamp(1.8rem, 4vw, 3rem);
  --fs-body: clamp(1rem, 1.3vw, 1.125rem);
  --fs-lg:   1.125rem;    /* 18px — 로고 */
  --fs-sm:   0.875rem;    /* 14px — 보조 텍스트 · 버튼 */
  --fs-xs:   0.75rem;     /* 12px — 라벨 · 캡션 */
}
[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e8e0d5;
  --text-muted: #a8a098;
  --card-bg: #222222;

  --nav-bg: rgba(32,32,32,0.88);
  --nav-border: rgba(255,245,235,0.14);

  --border: rgba(255,245,235,0.08);

  /* 다크 모드 → 라이트 테마의 --bg(#f0ede8). */
  --focus: #f0ede8;
}

/* ============ 3. 리셋 · 베이스 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* 본문이 짧아도 푸터가 화면 맨 아래에 붙도록 세로 flex */
body {
  font-family: 'Pretendard Variable', Pretendard, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }

a, button { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* 본문 바로가기 — 포커스될 때만 보인다 */
.skip-link {
  position: absolute; left: 50%; top: 0; translate: -50% -120%;
  z-index: 300;
  padding: 0.7rem 1.25rem;
  background: var(--card-bg); color: var(--text);
  border: 1.5px solid var(--text); border-radius: 99px;
  font-size: var(--fs-sm); font-weight: 600;
  transition: translate 0.2s;
}
.skip-link:focus-visible { translate: -50% 12px; }

/* ============ 4. 연속 곡률 (iOS 스타일 squircle) ============
   누르는 것은 99px 캡슐 + superellipse(1.2). 새 버튼을 만들면 아래 목록에 넣는다.
   미지원 브라우저는 보통 둥근 모서리로 보인다. */
@supports (corner-shape: squircle) {
  .btn-lang,
  .btn-back,
  .skip-link,
  .btn-theme::before {
    corner-shape: superellipse(1.2);
  }
}

/* ============ 5. 포커스 표시 ============ */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
/* 본문 바로가기로 옮겨온 포커스. 본문 전체를 테두리로 감싸면 오히려 방해되므로 표시하지 않는다.
   (main 의 tabindex="-1" 은 스킵 링크가 실제로 포커스를 옮기기 위한 것) */
main[tabindex="-1"]:focus-visible { outline: none; }

/* ============ 6. 내비게이션 ============ */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  height: 64px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nav-border);
  transition: background var(--transition), border-color var(--transition);
}
.nav-logo {
  font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.03em;
  cursor: pointer; transition: opacity 0.2s;
}
.nav-logo:hover { opacity: 0.6; }
.nav-links { display: flex; align-items: center; gap: clamp(0.5rem, 1.6vw, 2rem); }

/* ============ 7. 버튼 ============ */
/* 언어 전환 (EN / KO) */
.btn-lang {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em;
  padding: 0.45rem 0.9rem; border-radius: 99px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
}
.btn-lang:hover { border-color: var(--text); color: var(--text); }
/* 보이는 크기는 그대로, 터치 영역만 44×44 */
.btn-lang::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: max(100%, 44px); height: max(100%, 44px);
}

/* 테마 토글 — 트랙(38×22)과 손잡이(16px)는 그대로,
   버튼 자체를 44×44 투명 박스로 만들어 터치 영역만 넓힌다 */
.btn-theme {
  width: 44px; height: 44px;
  border: none; background: transparent; padding: 0;
  position: relative; cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.btn-theme::before {
  content: ''; width: 38px; height: 22px; border-radius: 99px;
  background: var(--border); transition: background 0.3s;
}
.btn-theme:hover::before { opacity: 0.75; }
.btn-theme::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text);
  top: 50%; margin-top: -8px;
  left: 50%; margin-left: -16px;
  transition: transform 0.3s, background 0.3s;
}
[data-theme="dark"] .btn-theme::after { transform: translateX(16px); }

.btn-back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.4rem; border-radius: 99px;
  border: 1.5px solid var(--border); background: var(--card-bg);
  color: var(--text); font-size: var(--fs-sm); font-weight: 600;
  transition: all 0.2s;
}
.btn-back:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============ 8. 푸터 ============ */
footer {
  padding: 3rem clamp(1.5rem, 5vw, 4rem) 2rem;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
/* 아래 두 줄(0.75rem)과 확실히 구분되도록 이름만 키운다 */
.footer-name {
  font-size: clamp(1.4rem, 2.2vw, 1.7rem); font-weight: 700; letter-spacing: -0.03em;
  color: var(--text); margin-bottom: 0.75rem;
}
.footer-links { font-size: var(--fs-xs); color: var(--text); font-weight: 400; margin-bottom: 0.5rem; }
.footer-links a {
  color: var(--text); text-decoration: underline;
  text-underline-offset: 3px; transition: color 0.2s;
}
.footer-links a:hover { color: var(--text-muted); }
.footer-copy { font-size: var(--fs-xs); color: var(--text); font-weight: 400; }

/* ============ 9. 홈 ============ */
.landing {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.5rem; text-align: center;
  padding: calc(64px + 3rem) clamp(1.25rem, 5vw, 4rem) 4rem;
  animation: landing-in 0.9s cubic-bezier(0.4,0,0.2,1) both;
}
.landing-title {
  font-size: var(--fs-hero);
  font-weight: 700; letter-spacing: -0.04em; line-height: 1;
}
/* 한글 약 34자 폭. ch 는 숫자 폭 기준이라 한글에는 너무 좁게 잡힌다 */
.landing-tagline {
  max-width: 34em;
  font-size: var(--fs-body); line-height: 1.7; color: var(--text-muted);
  word-break: keep-all;
}
@keyframes landing-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ============ 10. 404 ============ */
/* 본문이 짧아도 푸터가 화면 맨 아래에 붙도록 남은 공간을 본문이 차지한다 */
.not-found {
  flex: 1 0 auto;
  min-height: 70vh; min-height: 70dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center;
  padding: 110px clamp(1.5rem, 5vw, 2rem) 80px;
}
.page-label {
  font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.1em; color: var(--text-muted);
}
.not-found h1 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; word-break: keep-all; }
.not-found p { font-size: var(--fs-body); color: var(--text-muted); word-break: keep-all; margin-bottom: 1rem; }

/* ============ 11. 모션 최소화 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  .landing { animation: none; }
}
