/* ──────── src/styles/global.css ──────── */
:root {
  /* Brand */
  --red: #ed1e24;
  --red-deep: #df0006;
  --red-flat: #f30000;
  --red-soft: #fff2f2;
  --red-tint: #f44336;

  /* Ink */
  --ink: #202020;
  --ink-strong: #232323;
  --ink-body: #727272;
  --ink-muted: #a8a8a8;
  --ink-footer: #757a83;

  /* Surface */
  --surface: #ffffff;
  --surface-gray: #f8f9fa;
  --surface-pink: #fff4f4;
  --surface-footer: #000000;
  --surface-frame: #eff0f0;

  /* State — 폼 피드백과 차트에서 쓰는 의미 색상 */
  --ok: #10803f;
  --warn: #9a6b00;
  --required: #f00;
  --ink-answer: #686868;
  --chart-base: #e6e6e6;

  /* Line */
  --line: #dadada;
  --line-soft: #dedede;
  --line-faq: #dfdfdf;
  --line-header: #dcdfe4;

  /* Layout */
  /*
   * 본문 섹션 사이의 세로 여백. 한 값으로 통일해 섹션 간 리듬을 맞춘다.
   *
   * 최솟값 88px — 모바일에서 적용되는 값이다. 일반 권장치(40~64px)보다 넓게 잡았다.
   *   "한 화면에 글이 너무 많이 들어온다"는 피드백을 반영한 것이라 좁히지 말 것.
   * 최댓값 230px — 시안 폭(1920px)에서의 값. 12vw × 1920 = 230.4 이라
   *   시안 폭까지는 화면을 따라 늘고 그 위로는 230px 에서 멈춘다.
   */
  --section-pad-min: 88px;
  --section-pad: clamp(var(--section-pad-min), 12vw, 230px);

  --container: 1180px;
  --container-wide: 1340px;
  --container-xwide: 1580px;
  --gutter: 24px;
  --header-h: 76px;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.02em;
  /* 한국어는 어절 단위로 끊는다. 끊을 데가 없는 긴 토큰만 강제로 넘긴다 */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 디자인 폭(1920)보다 좁은 화면에서도 가로 스크롤이 생기지 않게 한다 */
  overflow-x: hidden;
}

img,
svg,
iframe {
  max-width: 100%;
}

img {
  display: block;
  height: auto;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* outline 은 요소의 border-radius 를 따라가므로 여기서 radius 를 건드리면
   포커스 순간 모서리 모양이 바뀐다 */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Layout ───────────────────────────────────────────── */
.container {
  width: 100%;
  /* 콘텐츠 폭이 시안 값과 정확히 같아지도록 좌우 여백을 max-width 에 더해 준다 */
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: calc(var(--container-wide) + var(--gutter) * 2);
}

.container--xwide {
  max-width: calc(var(--container-xwide) + var(--gutter) * 2);
}

/* ── Type ─────────────────────────────────────────────── */
.t-eyebrow {
  margin: 0;
  color: var(--red);
  font-size: clamp(15px, 1.5vw, 22px);
  font-weight: 800;
}

.t-display {
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.t-section {
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 700;
  line-height: 1.37;
  color: var(--ink);
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  font-weight: 700;
  text-align: center;
}

.btn--primary {
  background: var(--red);
  color: #fff;
}

.btn--soft {
  background: var(--red-soft);
  color: var(--red-tint);
}

.btn--dark {
  background: #000;
  color: #fff;
}

.btn--lg {
  height: 55px;
  padding-inline: 28px;
  font-size: clamp(15px, 1.2vw, 18px);
}

.btn--md {
  height: 47px;
  padding-inline: 24px;
  font-size: 16px;
}

/* ── Scroll reveal ────────────────────────────────────────
   숨김 상태는 <html class="reveal-on"> 이 켠다. 스크립트가 없거나 죽으면
   index.html 의 <noscript> 가 다시 보이게 해 본문이 사라지지 않는다.
   주의: transform 이 걸린 요소는 background-attachment:fixed 를 깨뜨리므로
   패럴랙스 섹션(.urgency) 자체에는 data-reveal 을 붙이지 않는다. */
.reveal-on [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) var(--reveal-delay, 0ms);
}

.reveal-on [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal-on [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/*
 * 시안의 강제 줄바꿈은 1180px 컨테이너 기준으로 짜인 것이라 좁은 화면에서는
 * 줄 길이가 들쭉날쭉해진다. 한 단 레이아웃으로 바뀌는 900px 부터는 숨기고
 * 자연스럽게 흐르게 둔다. 숨겨도 단어가 붙지 않도록 JSX 에서 <br> 앞에 {' '} 를 넣었다.
 */
@media (max-width: 900px) {
  br.lb {
    display: none;
  }
}

/* 반대로, 좁은 화면에서만 끊고 싶은 자리 */
br.br-m {
  display: none;
}

@media (max-width: 900px) {
  br.br-m {
    display: inline;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/*
 * 모바일: 스크롤하면서 한 화면에 한 섹션만 들어오게 한다.
 *
 * - 섹션마다 화면 한 장을 최소로 보장하고 내용은 세로 가운데에 둔다.
 *   100vh 가 아니라 100svh 인 이유: vh 는 브라우저 툴바가 "숨은" 상태 기준이라
 *   툴바가 보이면 내용이 잘린다. dvh 는 툴바가 열고 닫힐 때마다 레이아웃이 튄다.
 *   svh 는 툴바가 보이는 상태 기준이라 항상 들어맞는다.
 * - 스냅은 proximity 로만 건다. mandatory 는 화면보다 긴 섹션(피처·FAQ·문의)에서
 *   중간에 멈추지 못하게 만들어 사용자를 가둔다.
 * - 섹션 위쪽이 sticky 헤더에 가리지 않도록 html 의 scroll-padding-top 을 쓴다.
 */
@media (max-width: 900px) {
  html {
    scroll-snap-type: y proximity;
    /* 스냅 위치를 헤더 바로 아래로 맞춘다. 여기에 여유를 더하면
       그만큼 앞 섹션 꼬리가 헤더 밑으로 삐져나온다 */
    scroll-padding-top: var(--header-h);
  }

  main > section,
  .cta-band {
    /* 헤더가 덮는 만큼 뺀 "한 화면". svh 를 쓰는 이유는 위 주석 참고 */
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    display: flex;
    flex-direction: column;
    justify-content: center;
    scroll-snap-align: start;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  html {
    scroll-snap-type: none;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 20px;
    --header-h: 60px;
  }

  /* 55px 은 모바일에서 둔해 보인다. 48px 이면 44px 탭 기준도 넉넉히 넘는다 */
  .btn--lg {
    height: 48px;
    font-size: 16px;
  }

  .btn--md {
    height: 46px;
  }
}

/* ──────── src/components/SiteHeader.css ──────── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--line-header);
}

.header__inner {
  display: flex;
  align-items: center;
  height: var(--header-h);
  gap: 56px;
}

.header__logo {
  display: inline-flex;
  align-items: center;
  /* 로고 링크도 탭 영역 44px 를 채운다 */
  min-height: 44px;
}

.header__logo img {
  height: 27px;
  width: auto;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 40px;
  font-size: 15px;
  font-weight: 600;
}

.header__nav a {
  color: #000;
  padding-block: 6px;
  transition: color 0.16s ease;
}

.header__nav a:hover {
  color: var(--red);
}

.header__cta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding-inline: 18px;
  border-radius: 8px;
  background: #000;
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
}

.header__burger {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  place-items: center;
}

.header__burger-bars,
.header__burger-bars::before,
.header__burger-bars::after {
  display: block;
  width: 20px;
  height: 2px;
  background: #000;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.header__burger-bars::before,
.header__burger-bars::after {
  content: '';
  position: absolute;
}

.header__burger-bars::before {
  transform: translateY(-6px);
}

.header__burger-bars::after {
  transform: translateY(6px);
}

.header__burger-bars[data-open='true'] {
  background: transparent;
}

.header__burger-bars[data-open='true']::before {
  transform: rotate(45deg);
}

.header__burger-bars[data-open='true']::after {
  transform: rotate(-45deg);
}

.header__mobile {
  display: none;
}

@media (max-width: 860px) {
  .header__nav {
    display: none;
  }

  /* 메뉴가 있을 때만 CTA 를 햄버거 안으로 넣는다.
     메뉴가 없으면 햄버거도 없으므로 CTA 가 그대로 보여야 한다 */
  .header[data-nav='true'] .header__cta {
    display: none;
  }

  /* 탭 영역 44px (iOS HIG / WCAG 2.5.5) */
  .header__cta {
    height: 44px;
  }

  /* 27px 이면 390px 화면에서 로고가 가로 180px — 화면의 46% 를 먹는다.
     18px 이면 120px (31%) 로 모바일 헤더에 맞는 비중이 된다. */
  .header__logo img {
    height: 18px;
  }

  .header__burger {
    display: grid;
    position: relative;
  }

  .header__mobile {
    display: grid;
    gap: 2px;
    overflow: hidden;
    max-height: 0;
    padding-inline: var(--gutter);
    border-top: 1px solid transparent;
    background: #fff;
    transition: max-height 0.24s ease, padding-block 0.24s ease,
      border-color 0.24s ease;
  }

  .header__mobile[data-open='true'] {
    max-height: 320px;
    padding-block: 12px 18px;
    border-top-color: var(--line-header);
  }

  .header__mobile a {
    padding-block: 12px;
    font-size: 16px;
    font-weight: 600;
  }

  .header__mobile-cta {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    border-radius: 9px;
    background: #000;
    color: #fff;
  }
}

/* ──────── src/sections/SiteFooter.css ──────── */
.footer {
  background: var(--surface-footer);
  padding-block: clamp(56px, 7vw, 118px) clamp(48px, 6vw, 112px);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-footer);
}

.footer__inner {
  display: grid;
  gap: clamp(56px, 7vw, 122px);
}

.footer__logo {
  height: 26px;
  width: auto;
  /* 로고 SVG 가 전부 fill="black" 이라 검은 배경에서 안 보인다.
     흰 버전을 따로 두지 않고 반전시킨다 — 색이 바뀐 로고를 받아도 흰색이 된다 */
  filter: brightness(0) invert(1);
}

.footer__address {
  margin-top: 28px;
  display: grid;
  gap: 12px;
  font-style: normal;
}

/* 운영사(haip.kr) 링크 — sameAs 와 짝을 이루는 실제 하이퍼링크 */
.footer__sibling {
  margin-top: 16px;
}

.footer__sibling a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer__legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 20px;
  margin-top: 16px;
}

.footer__legal a {
  /* 탭 영역 44px (iOS HIG / WCAG 2.5.5) */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 색은 같게 두고 굵기로만 구분한다. 개인정보 처리방침은 다른 고지사항과
   구분되게 표시해야 하는데(개인정보 보호법 시행령 제31조 — 크기·색상·굵기 등),
   굵기만으로도 그 요건은 충족한다 */
.footer__privacy {
  font-weight: 700;
}

.footer__copy {
  margin-top: 16px;
}

/* ──────── src/legal/legal.css ──────── */
/*
 * 법정 고지 페이지에만 있는 스타일. 토큰 · 리셋 · 상단바 · 푸터는 랜딩과 같은
 * 파일을 그대로 쓴다 — vite.config.js 의 SHARED_CSS 가 이어 붙여 준다.
 *
 * 규칙을 전부 .legal__ 안으로 좁혀 두는 이유: 전역 요소 선택자(a, body, ul …)를
 * 쓰면 이어 붙인 상단바 · 푸터까지 같이 끌려간다.
 */

.legal {
  padding-block: clamp(48px, 6vw, 88px) clamp(64px, 8vw, 120px);
}

.legal__inner {
  /* 본문 폭만 좁힌다. --container 토큰을 덮으면 상단바 폭까지 같이 줄어든다 */
  max-width: calc(860px + var(--gutter) * 2);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-body);
}

.legal__head {
  padding-bottom: 28px;
  margin-bottom: 40px;
  border-bottom: 2px solid var(--ink);
}

.legal__title {
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.legal__effective {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* 본문 링크만 밑줄. 범위를 좁혀 상단바 CTA · 푸터 링크가 끌려가지 않게 한다 */
.legal__inner a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line);
  transition: color 0.16s ease, text-decoration-color 0.16s ease;
}

.legal__inner a:hover {
  color: var(--red);
  text-decoration-color: currentColor;
}

/* 작성지침 2025.4 가 권하는 상단 라벨링 요약 */
.legal__labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  margin: 0 0 44px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}

.legal__label {
  padding: 18px 20px;
  background: var(--surface-gray);
}

.legal__label dt {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--red);
}

.legal__label dd {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

.legal__lead {
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--ink);
}

.legal__note {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--surface-gray);
  border-radius: 8px;
  font-size: 15.5px;
  line-height: 1.75;
}

.legal__inner h2 {
  margin-top: 52px;
  margin-bottom: 14px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.legal__inner h3 {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* 앞에 무엇이 오든 문단은 같은 간격을 띄운다. p+p 만 잡아 두면
   목록이나 표 바로 뒤의 문단이 앞 블록에 달라붙는다 */
.legal__inner p + p,
.legal__inner ul + p,
.legal__inner .legal__table-wrap + p {
  margin-top: 14px;
}

.legal__inner b {
  color: var(--ink);
  font-weight: 700;
}

.legal__inner ul {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.legal__inner li {
  position: relative;
  padding-left: 15px;
}

.legal__inner li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-muted);
}

/* ── 표 ───────────────────────────────────────────────── */
.legal__table-wrap {
  /* 좁은 화면에서 표만 가로로 스크롤된다. 페이지 전체가 밀리지 않게 한다 */
  margin-top: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.legal__table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.7;
}

.legal__table th,
.legal__table td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}

.legal__table thead th {
  background: var(--surface-gray);
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

.legal__table tbody tr:last-child td {
  border-bottom: 0;
}

.legal__table td:first-child {
  font-weight: 600;
  color: var(--ink);
}

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

  .legal__inner h2 {
    margin-top: 44px;
    font-size: 18px;
  }

  /* 본문 글자는 모바일에서 16px 아래로 내리지 않는다 (DEVELOPMENT.md 모바일 UX 기준) */
  .legal__label dd,
  .legal__note,
  .legal__table {
    font-size: 16px;
  }

  /*
   * 문장 속 링크의 탭 영역을 24px 위로 (WCAG 2.5.8 AA).
   * display 는 inline 그대로 둔다 — inline-block 으로 바꾸면 긴 링크가
   * 한 덩어리가 돼서 문장 중간에서 줄바꿈되지 않고 삐져나온다.
   */
  .legal__inner a {
    padding-block: 5px;
  }
}
