/* ===== 히어로 (메인 화면) ===== */
.hero { position: relative; z-index: 2; padding: 20px 20px 0; }
.hero-card {
  position: relative; overflow: hidden; isolation: isolate;
  height: clamp(560px, calc(100vh - 40px), 900px);
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 90% at 50% 30%, #98a876 0%, var(--sage) 55%, var(--sage-dark) 100%);
  transform-origin: 50% 0%;
  will-change: transform, opacity;
  transition: background 0.6s;
}
.hero-card.is-cat { background: radial-gradient(120% 90% at 50% 30%, #c9a98a 0%, #b8957a 55%, #a5826a 100%); }

/* 사진 같은 질감: 노이즈 + 가장자리 그늘 */
.hero-grain {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.12) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.35; mix-blend-mode: multiply;
}

/* 큰 로고: 글자가 하나씩 올라옴 */
.hero-title {
  position: absolute; left: 50%; top: 12%; z-index: 0; translate: -50% 0;
  margin: 0; white-space: nowrap;
  font-size: clamp(110px, 23vw, 340px); font-weight: 900; line-height: 1;
  letter-spacing: -0.06em; color: var(--white);
}
.hero-title .ch {
  display: inline-block;
  animation: chRise 1s var(--ease) both;
  animation-delay: calc(0.1s + var(--i) * 0.09s);
}

/* 강아지·고양이: 영상이 있으면 영상, 없으면 사진 */
.hero-media {
  position: absolute; inset: 0; z-index: 1;
  animation: mediaIn 1.2s 0.25s var(--ease) both;
  transition: opacity 0.35s;
}
.hero-media.is-swapping { opacity: 0; }
/*
 * 가슴 위 클로즈업이라 아래 끝이 잘려 있습니다(tools/make_hero_video.py).
 * 잘린 끝을 카드 아래 끝에 붙이고, 귀가 "댕댕로" 글자 아래쪽을 살짝 가리도록
 * 높이를 글자 크기(.hero-title 의 font-size)에 맞춰 정합니다. 카드보다 넓어지면 contain 으로 줄어듭니다.
 */
.hero-pet, .hero-video {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: calc(88% - 0.5 * min(23vw, 340px)); max-width: none;
  object-fit: contain; object-position: 50% 100%;
}
.hero-pet {
  transform-origin: 50% 100%;
  animation: breathe 4.2s ease-in-out infinite;
  transition: opacity 0.4s;
}
.hero-video { opacity: 0; transition: opacity 0.5s; }
.hero-media.has-video .hero-video { opacity: 1; }
.hero-media.has-video .hero-pet { opacity: 0; animation: none; }

/* 손그림 선 */
.hero-doodle {
  position: absolute; z-index: 2; pointer-events: none;
  fill: none; stroke: var(--white); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round;
}
.hero-doodle--sparks { left: calc(50% - 270px); top: 52%; width: 100px; }
.hero-doodle--loop { right: calc(50% - 400px); top: 56%; width: 150px; }

/* 노란색이 차오르는 버튼 */
.fill-btn {
  position: relative; display: inline-flex; align-items: center;
  width: 100%; max-width: 380px; height: 76px; padding: 0 40px;
  border-radius: 999px; background: var(--white); color: var(--green-800);
  font-weight: 700; font-size: 16px; overflow: hidden; isolation: isolate;
}
.fill-btn__layer {
  position: absolute; inset: -1px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px 0 40px; border-radius: inherit; background: var(--yellow);
  clip-path: circle(24px at calc(100% - 42px) 50%);
  transition: clip-path 0.7s var(--ease);
}
.fill-btn:hover .fill-btn__layer,
.fill-btn:focus-visible .fill-btn__layer { clip-path: circle(150% at calc(100% - 42px) 50%); }
.fill-btn__arrow { position: relative; width: 48px; height: 48px; overflow: hidden; }
.fill-btn__arrow svg {
  position: absolute; left: 14px; top: 14px; width: 20px; height: 20px;
  transition: transform 0.45s var(--ease);
}
.fill-btn__arrow svg + svg { transform: translateX(-40px); }
.fill-btn:hover .fill-btn__arrow svg:first-child { transform: translateX(40px); }
.fill-btn:hover .fill-btn__arrow svg + svg { transform: none; }

.hero-cta { position: absolute; left: 24px; bottom: 24px; z-index: 3; }

/* 강아지/고양이 사진 스위치 */
.pet-switch {
  --size: 64px; --gap: 4px;
  position: absolute; right: 24px; bottom: 24px; z-index: 3;
  display: flex; gap: var(--gap); padding: 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.pet-switch__highlight {
  position: absolute; left: 6px; top: 6px; width: var(--size); height: var(--size);
  border-radius: 50%; background: var(--yellow);
  transition: transform 0.5s var(--ease);
}
.pet-switch[data-active="cat"] .pet-switch__highlight { transform: translateX(calc(100% + var(--gap))); }
.pet-btn {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: var(--size); height: var(--size); border-radius: 50%;
}
.pet-btn img {
  width: calc(var(--size) - 12px); height: calc(var(--size) - 12px); border-radius: 50%;
  object-fit: cover; object-position: 50% 12%; background: var(--lavender);
  filter: grayscale(0.7); opacity: 0.8;
  transition: transform 0.3s var(--ease), filter 0.3s, opacity 0.3s;
}
.pet-btn.is-active img { filter: none; opacity: 1; }
.pet-btn:hover img { transform: scale(1.06); }

@keyframes chRise { from { opacity: 0; transform: translateY(55%) rotate(5deg); } to { opacity: 1; transform: none; } }
@keyframes mediaIn { from { opacity: 0; transform: translateY(70px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012, 1.018); } }

@media (max-width: 980px) {
  .hero-doodle--sparks { left: 8%; }
  .hero-doodle--loop { right: 6%; }
}
@media (max-width: 640px) {
  .hero { padding: 12px 12px 0; }
  .hero-card { height: min(680px, calc(100svh - 24px)); min-height: 600px; border-radius: 28px; }
  .hero-title { top: 16%; font-size: 30vw; }
  /*
   * 아래 끝에 붙이면 입이 버튼에 가려지므로, 잘린 끝이 버튼(.hero-cta: 아래 96px, 높이 62px) 뒤에 오도록 올리고
   * 끝 40px 을 흐리게 해서 버튼 양옆으로 잘린 선이 보이지 않게 합니다.
   */
  .hero-pet, .hero-video {
    bottom: 120px; height: calc(84% - 120px - 24vw);
    -webkit-mask-image: linear-gradient(to top, transparent, #000 40px);
    mask-image: linear-gradient(to top, transparent, #000 40px);
  }
  .hero-doodle--sparks { left: 4%; top: 42%; width: 64px; }
  .hero-doodle--loop { display: none; }
  .fill-btn { height: 62px; padding: 0 26px; font-size: 15px; }
  .fill-btn__layer { padding-left: 26px; padding-right: 10px; clip-path: circle(22px at calc(100% - 34px) 50%); }
  .fill-btn:hover .fill-btn__layer, .fill-btn:focus-visible .fill-btn__layer { clip-path: circle(150% at calc(100% - 34px) 50%); }
  .hero-cta { left: 12px; right: 12px; bottom: 96px; width: auto; max-width: none; }
  .pet-switch { --size: 56px; right: auto; left: 50%; bottom: 16px; translate: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-pet { animation: none; }
}
