/*
 * 홈(소개) 페이지 전용 스타일. 공통 헤더·푸터·폰트·기본 요소는
 * @puzzlog/web-ui의 styles.css가 소유하고, 이 파일은 그 뒤에 불러온다.
 */

.home-page {
  /* 브랜드 토큰 (apps/mobile/design-tokens.json과 같은 값) */
  --surface: #ffffff;
  --surface-soft: #fafaf7;
  --footer-surface: var(--surface-soft);
  --line: #e6e8df;
  --yellow: #f4df8b;
  --yellow-soft: #fbf3d2;
  --green: #bedac5;
  --green-soft: #e9f3ec;
  --blue: #bad6eb;
  --blue-soft: #e8f1f8;
  --pink: #f3c8c0;
  --pink-soft: #fbeae8;
  --max: 1080px;
  --gutter: 24px;
  font-size: 17px;
  overflow-x: hidden;
}

.home-page img {
  display: block;
  max-width: 100%;
  height: auto;
}

.home-page h1,
.home-page h2,
.home-page h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
}

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

/* ---------- 공통 ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--ink-muted);
  font-size: 16px;
}

.eyebrow__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
}

h1,
h2 {
  text-wrap: balance;
}

h2 {
  font-size: clamp(26px, 3.2vw, 36px);
}

.section-lead,
.feature__copy p:not(.eyebrow) {
  margin: 16px 0 0;
  color: var(--ink-muted);
}

/* App Store 배지: 공식 배지를 수정하지 않고, 높이의 1/4 이상 여백을 둔다. */
.store-badge {
  display: inline-block;
  padding: 14px 0;
}

.store-badge img {
  width: auto;
  height: 54px;
}

/* ---------- 히어로 ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 40px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px var(--gutter) 72px;
}

.hero h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.3;
}

.hero__lead {
  margin: 20px 0 16px;
  color: var(--ink-muted);
  font-size: 19px;
  line-height: 1.6;
}

.hero__visual {
  position: relative;
  justify-self: center;
  width: 100%;
}

/* 스크린샷은 스토어 원본 HTML을 투명 배경으로 다시 렌더링한 것이라 그대로 얹는다. */
.hero__visual .phone {
  position: relative;
}

.blob {
  position: absolute;
  inset: 10% -8% 6% -8%;
  border-radius: 46% 54% 48% 52% / 52% 44% 56% 48%;
  background: var(--yellow-soft);
}

.buddy {
  position: absolute;
  z-index: 2;
  height: auto;
}

.buddy--pink {
  top: 4%;
  right: -4%;
  width: 22%;
}

.buddy--blue {
  top: 30%;
  left: -8%;
  width: 18%;
}

.float {
  animation: float 4.2s ease-in-out infinite;
}

.float--late {
  animation-delay: -2.1s;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

/* ---------- 인트로 ---------- */

.intro {
  padding: 72px var(--gutter);
  background: var(--surface-soft);
  text-align: center;
}

.intro__friends {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 20px;
}

.intro__friends img {
  width: 60px;
  height: 60px;
}

.intro__friends img:nth-child(even) {
  transform: translateY(6px);
}

.intro__quote {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  line-height: 1.6;
}

/* ---------- 테마 ---------- */

.themes {
  max-width: var(--max);
  margin: 0 auto;
  padding: 112px var(--gutter) 48px;
  text-align: center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 19px;
  font-weight: 700;
}

.chip:nth-child(odd) {
  transform: rotate(-3deg);
}

.chip:nth-child(even) {
  transform: rotate(2deg);
}

.chip--yellow {
  background: var(--yellow);
}

.chip--green {
  background: var(--green);
}

.chip--blue {
  background: var(--blue);
}

.chip--pink {
  background: var(--pink);
}

/*
 * 퍼스널 테마 칩: 앱의 입력 칩(Chip variant="input")처럼
 * 점선 "+" → 실선 입력 칸에 타이핑 → 연두색 퍼스널 칩으로 확정된다.
 */
.chip--personal {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 60px;
  justify-content: center;
  padding: 6px 20px;
  border: 2px dashed #a9c295;
  background: transparent;
}

.chip__plus {
  color: #7f9a6c;
}

.chip__text:empty {
  display: none;
}

.chip--personal:not([data-state="idle"]) .chip__plus {
  display: none;
}

.chip--personal[data-state="typing"] {
  border-style: solid;
  background: #fff;
}

.chip--personal[data-state="typing"] .chip__text::after {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.12em;
  background: var(--ink);
  animation: caret 0.9s steps(1) infinite;
  content: "";
}

/* 빈 입력 칸에서도 커서가 보이게 한다. */
.chip--personal[data-state="typing"] .chip__text:empty {
  display: inline;
}

.chip--personal[data-state="done"] {
  border-color: transparent;
  background: #e2ecd8;
  animation: pop 0.4s ease-out;
}

.chip__remove {
  position: absolute;
  top: -7px;
  right: -5px;
  display: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--pink);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-align: center;
}

.chip--personal[data-state="done"] .chip__remove {
  display: block;
  animation: pop 0.4s ease-out 0.15s both;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

@keyframes pop {
  0% {
    scale: 1;
  }
  45% {
    scale: 1.12;
  }
  100% {
    scale: 1;
  }
}

/* ---------- 기능 ---------- */

.feature {
  display: grid;
  grid-template-columns: 5fr 6fr;
  align-items: center;
  gap: 56px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px var(--gutter);
}

.feature--reverse {
  grid-template-columns: 6fr 5fr;
}

.feature--reverse .feature__visual {
  order: 2;
}

/* 로그인이 필요한 기능 안내 */
.login-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 0;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.4;
}

.login-note svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.feature__visual {
  display: grid;
  place-items: center;
  padding: 40px 32px 16px;
  border-radius: 40px;
}

.feature__visual .phone {
  width: min(100%, 340px);
}

.feature__visual--green {
  background: var(--green-soft);
}

.feature__visual--blue {
  background: var(--blue-soft);
}

.feature__visual--pink {
  background: var(--pink-soft);
}

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

.feature__copy--center {
  text-align: center;
}

.feature__visual--wide {
  padding: 0;
}

.spread {
  width: min(100%, 900px);
}

/* ---------- 작은 기능 ---------- */

.extras {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px var(--gutter) 96px;
  text-align: center;
}

.extras__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.card {
  padding: 24px 22px 26px;
  border-radius: 28px;
}

/* 카드마다 내용에 맞는 작은 모션 */
.motion {
  position: relative;
  display: flex;
  align-items: center;
  height: 64px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 20px;
}

.card p {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 15px;
  line-height: 1.65;
}

.card--yellow {
  background: var(--yellow-soft);
}

.card--green {
  background: var(--green-soft);
}

.card--pink {
  background: var(--pink-soft);
}

.card--blue {
  background: var(--blue-soft);
}

.layout-demo {
  display: grid;
  gap: 3px;
  width: 52px;
  height: 56px;
}

.layout-demo i {
  border-radius: 5px;
  animation: cell-in 0.35s ease-out both;
}

.layout-demo i:nth-child(4n + 1) {
  background: var(--yellow);
}

.layout-demo i:nth-child(4n + 2) {
  background: var(--green);
}

.layout-demo i:nth-child(4n + 3) {
  background: var(--pink);
}

.layout-demo i:nth-child(4n + 4) {
  background: var(--blue);
}

.layout-demo[data-layout="2x1"] {
  grid-template: repeat(2, 1fr) / 1fr;
}

.layout-demo[data-layout="2x2"] {
  grid-template: repeat(2, 1fr) / repeat(2, 1fr);
}

.layout-demo[data-layout="3x2"] {
  grid-template: repeat(3, 1fr) / repeat(2, 1fr);
}

.layout-demo[data-layout="3x3"] {
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
}

.layout-demo[data-layout="2x1"] i:nth-child(n + 3),
.layout-demo[data-layout="2x2"] i:nth-child(n + 5),
.layout-demo[data-layout="3x2"] i:nth-child(n + 7) {
  display: none;
}

@keyframes cell-in {
  from {
    scale: 0.6;
  }
}

/* 로그인 없이 시작: 입장권 꼬리표(스텁)가 점선에서 뗐다 붙었다 한다. 양쪽 모두 점선. */
.ticket {
  width: 58px;
  height: 58px;
  overflow: visible;
  /* 퍼스널 칩 점선(#a9c295)과 와이파이(#6f9a64) 사이의 초록: 카드 모션 색을 한 계열로 묶는다 */
  stroke: #8fae7b;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* 점선·글자 줄은 면적이 없는 선이라 채워져도 보이지 않고, 외곽선만 면이 칠해진다 */
  fill: #fbeae8;
}

/* 뜯어지는 기준점은 절취선 아래 끝 */
.ticket__body,
.ticket__stub {
  transform-origin: 16.5px 18.75px;
}

/* 붙음 1.2s → 벌어짐 0.8s → 벌어진 채 1.2s → 다시 붙음 0.8s (4s 반복) */
.ticket__body {
  animation: ticket-body 4s infinite;
}

.ticket__stub {
  animation: ticket-tear 4s infinite;
}

@keyframes ticket-body {
  0%,
  30% {
    rotate: 0deg;
    animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
  }
  50%,
  80% {
    rotate: -2deg;
    animation-timing-function: cubic-bezier(0.4, 0, 0.3, 1);
  }
  100% {
    rotate: 0deg;
  }
}

@keyframes ticket-tear {
  0%,
  30% {
    rotate: 0deg;
    translate: 0 0;
    animation-timing-function: cubic-bezier(0.3, 0, 0.2, 1);
  }
  50%,
  80% {
    rotate: 16deg;
    translate: 1px 0.6px;
    animation-timing-function: cubic-bezier(0.4, 0, 0.3, 1);
  }
  100% {
    rotate: 0deg;
    translate: 0 0;
  }
}

/* 퍼스널 테마: 테마 섹션의 입력 칩을 작게 */
.chip--small {
  min-width: 48px;
  padding: 4px 14px;
  font-size: 16px;
}

/* 오프라인: 끊긴 와이파이 → 연결되면 우측 상단에서 동기화 → 초록 체크 (4s 반복) */
.offline__icon {
  position: relative;
  display: inline-block;
}

.offline__wifi {
  display: block;
  width: 46px;
  height: 46px;
  color: #6f9a64;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  animation: offline-wifi 4s steps(1) infinite;
}

.offline__wifi circle {
  fill: currentColor;
  stroke: none;
}

.offline__slash {
  stroke: #e08e80;
  stroke-width: 2.4;
  opacity: 0;
  animation: offline-slash 4s ease-in-out infinite;
}

.offline__sync {
  position: absolute;
  top: -6px;
  right: -12px;
  width: 24px;
  height: 24px;
}

.offline__sync svg {
  position: absolute;
  inset: 0;
  width: 24px;
  height: 24px;
  padding: 4px;
  border-radius: 50%;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.offline__spin {
  stroke: #6f9a64;
  background: #fff;
  opacity: 0;
  animation:
    offline-spin-show 4s steps(1) infinite,
    spin 0.8s linear infinite;
}

.offline__check {
  stroke: #fff;
  background: #6f9a64;
  animation: offline-check 4s ease-out infinite;
}

@keyframes offline-wifi {
  0% {
    color: #a4aaa2;
  }
  38% {
    color: #6f9a64;
  }
}

@keyframes offline-slash {
  0%,
  32% {
    opacity: 1;
  }
  38%,
  100% {
    opacity: 0;
  }
}

@keyframes offline-spin-show {
  0% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  66% {
    opacity: 0;
  }
}

@keyframes spin {
  to {
    rotate: 1turn;
  }
}

@keyframes offline-check {
  0%,
  65% {
    opacity: 0;
    scale: 0.3;
  }
  71% {
    opacity: 1;
    scale: 1.2;
  }
  76%,
  92% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 1;
  }
}

/* ---------- 하단 CTA ---------- */

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px var(--gutter) 72px;
  background: var(--yellow-soft);
  text-align: center;
}

.cta__mascot {
  width: 104px;
  height: 104px;
  margin-bottom: 16px;
}

.cta h2 {
  margin-bottom: 20px;
}

/* ---------- 반응형 ---------- */

@media (max-width: 960px) {
  .extras__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .home-page {
    --gutter: 16px;
    font-size: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 28px;
    padding-bottom: 56px;
    text-align: center;
  }

  .hero__lead {
    font-size: 17px;
  }

  .hero__visual {
    width: min(86%, 340px);
  }

  .store-badge img {
    height: 48px;
  }

  .themes {
    padding-top: 80px;
  }

  .feature,
  .feature--reverse {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 48px var(--gutter);
    text-align: center;
  }

  .feature__copy {
    order: -1;
  }

  .feature__visual {
    padding: 28px 20px 8px;
    border-radius: 32px;
  }

  .feature__visual .phone {
    width: min(100%, 280px);
  }

  .extras__grid {
    gap: 12px;
  }

  .card {
    padding: 20px 16px 22px;
  }

  .card h3 {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .float,
  .layout-demo i,
  .ticket__body,
  .ticket__stub,
  .offline__wifi,
  .offline__slash,
  .offline__spin,
  .offline__check,
  .chip--personal[data-state="done"],
  .chip--personal[data-state="done"] .chip__remove {
    animation: none;
  }
}
