* {
  box-sizing: border-box;
}

@font-face {
  font-family: "Cafe24Ohsquare";
  src: url("../assets/fonts/Cafe24Ohsquare.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", -apple-system,
    BlinkMacSystemFont, sans-serif;
  background: #fff;
}

/* ---------- Hero (Figma design) ---------- */

/* Pinned directly to the visible viewport instead of sized with vh/dvh —
   some in-app browsers (KakaoTalk, Naver, etc.) miscompute dvh against
   their own chrome, leaving a gap that becomes scrollable. position:fixed
   tracks the real viewport rect natively, so there's never a mismatch. */
.hero {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  line-height: 0;
}

/* Desktop: full-bleed background layer + capped-width content layer,
   so only the background photo widens on very large screens. The section
   always fills the viewport height so there's no dead space below;
   content stays pinned to the top (as designed) and any extra vertical
   room is absorbed by the background at the bottom. */
.hero-desktop {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero-bg img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 2752px;
  flex: 0 0 auto;
  aspect-ratio: 2752 / 1280;
  overflow: visible;
  container-type: inline-size;
  /* The desktop artwork is 2752 x 1280. When the viewport is taller than
     that ratio, only the lower scene is moved into the extra space. */
  --hero-bottom-shift: max(0px, calc(100vh - 46.5116cqw));
  --hero-bottom-shift: max(0px, calc(100dvh - 46.5116cqw));
}

/* Title text is real HTML (not baked into the SVG) so copy can change
   without re-exporting art. Sized with cqw so it scales exactly like the
   rest of the 2752-wide composition. */
.hero-title {
  position: absolute;
  left: calc(83 / 2752 * 100cqw);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  font-family: "Cafe24Ohsquare", "Pretendard", sans-serif;
}

.hero-title--1 {
  top: calc(35 / 2752 * 100cqw);
  font-size: calc(87 / 2752 * 100cqw);
  color: #1d70ff;
  text-shadow: calc(4.649 / 2752 * 100cqw) calc(4.649 / 2752 * 100cqw) 0 #81b6dc;
}

.hero-title--2 {
  top: calc(148 / 2752 * 100cqw);
  font-size: calc(70 / 2752 * 100cqw);
  color: #fff;
}

/* Kids sit in the same fixed-ratio box as the text/bubbles, so they move
   and scale together as one composition — only the plain background
   behind them is allowed to stretch independently. */
.hero-kids {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* crop from the empty headroom above the kids, never from their feet */
  object-position: center bottom;
  transform: translateY(var(--hero-bottom-shift));
}

.hero-fg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* The foreground SVG contains both the header logos and the speech
   bubbles. Render it in two clipped layers so the logos stay at the top
   while the bubbles remain grouped with the kids at the viewport bottom. */
.hero-fg--top {
  clip-path: inset(0 0 80.46875% 0);
}

.hero-fg--bottom {
  clip-path: inset(19.53125% 0 0 0);
  transform: translateY(var(--hero-bottom-shift));
}

/* Mobile: full-bleed background layer + aspect-ratio-locked content layer,
   mirroring the desktop hero pattern above. The section always fills at
   least the viewport height so there's no dead space below; content stays
   pinned to the top at its native scale (no cropping/stretching) and any
   extra vertical room is absorbed by the background at the bottom. */
.hero-mobile {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  line-height: 0;
  container-type: size;
}

.hero-mobile-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Crop evenly from the top and bottom across different portrait ratios. */
  object-position: center center;
  transform: scale(1.2);
  transform-origin: 50% 50%;
}

/* Width is capped so height never exceeds the viewport (no scroll): on
   tall/narrow screens it's 100%, with the background showing through
   below; on short/wide screens it shrinks and centers, with the
   background showing through on the sides instead.
   Geometry below (viewBox 3440 x 8820) is transcribed directly from
   Figma node 2177:8623 ("mobile-fin") — each piece is its own exported,
   pre-flattened image positioned at its exact frame coordinates, so the
   spacing between logo / title / kids / bubbles matches the design
   without needing to reconstruct Figma's internal group structure. */
.hero-mobile-content {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: min(100%, calc(100vh * 3440 / 8820));
  width: min(100%, calc(100dvh * 3440 / 8820));
  width: min(100%, calc(100cqh * 3440 / 8820));
  aspect-ratio: 3440 / 8820;
  overflow: hidden;
  container-type: inline-size;
}

.hero-mobile-content img {
  position: absolute;
  display: block;
  height: auto;
}

.mobile-fin-logo {
  left: calc(984.97 / 3440 * 100cqw);
  top: calc(841 / 3440 * 100cqw);
  width: calc(1470.37 / 3440 * 100cqw);
}

/* Wider than the frame and offset — clipped by the content box's own
   overflow:hidden, matching how the source Figma frame clips it. */
.mobile-fin-kids {
  left: calc(-1224 / 3440 * 100cqw);
  top: calc(3614 / 3440 * 100cqw);
  width: calc(6239.686 / 3440 * 100cqw);
}

.mobile-fin-bubble1 {
  left: calc(128 / 3440 * 100cqw);
  top: calc(4268 / 3440 * 100cqw);
  width: calc(1348.683 / 3440 * 100cqw);
}

.mobile-fin-bubble2 {
  left: calc(1924 / 3440 * 100cqw);
  top: calc(4351 / 3440 * 100cqw);
  width: calc(1349 / 3440 * 100cqw);
}

.hero-title-m {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  font-family: "Cafe24Ohsquare", "Pretendard", sans-serif;
}

.hero-title-m--1 {
  top: calc(1246.56 / 3440 * 100cqw);
  font-size: calc(299.4 / 3440 * 100cqw);
  color: #1d70ff;
  text-shadow: calc(15.997 / 3440 * 100cqw) calc(15.997 / 3440 * 100cqw) 0 #81b6dc;
}

.hero-title-m--2 {
  top: calc(1636.51 / 3440 * 100cqw);
  font-size: calc(211.692 / 3440 * 100cqw);
  color: #fff;
}

/* Portrait viewports (phones AND portrait tablets) get the mobile layout
   even past 767px wide — width alone misclassifies a portrait tablet as
   desktop, squeezing the landscape-shaped desktop composition into a tall
   screen with a huge dead background gap below it. */
@media (max-width: 767px), (orientation: portrait) {
  .hero-desktop {
    display: none;
  }
  .hero-mobile {
    display: block;
  }
}

.hero-hit {
  position: absolute;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hero-hit:hover,
.hero-hit:focus-visible {
  filter: brightness(1.04);
}

.hero-hit:active {
  filter: brightness(0.97);
}

/* Desktop hit areas (viewBox 2752 x 1280) — exact bubble bounds from Figma node 2136:118 */
.hit-apply {
  left: 20.27%;
  top: 21.25%;
  width: 23.51%;
  height: 19.30%;
  transform: translateY(var(--hero-bottom-shift));
}

.hit-more {
  left: 61.74%;
  top: 23.52%;
  width: 29.29%;
  height: 33.34%;
  transform: translateY(var(--hero-bottom-shift));
}

/* Mobile hit areas (viewBox 3440 x 8820) — match the bubble1/bubble2
   image bounds exactly, from Figma node 2177:8623 ("mobile-fin") */
@media (max-width: 767px), (orientation: portrait) {
  .hit-apply {
    left: calc(128 / 3440 * 100cqw);
    top: calc(4268 / 3440 * 100cqw);
    width: calc(1348.683 / 3440 * 100cqw);
    height: calc(642.999 / 3440 * 100cqw);
    transform: none;
  }

  .hit-more {
    left: calc(1924 / 3440 * 100cqw);
    top: calc(4351 / 3440 * 100cqw);
    width: calc(1349 / 3440 * 100cqw);
    height: calc(714.15 / 3440 * 100cqw);
    transform: none;
  }
}

/* ---------- PDF modal ---------- */

.pdf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  z-index: 1000;
}

.pdf-overlay.open {
  display: flex;
}

.pdf-modal {
  background: #fff;
  width: min(760px, 100%);
  height: min(88vh, 1000px);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pdf-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #eee;
  flex: 0 0 auto;
}

.pdf-modal__title {
  font-size: 16px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdf-modal__close {
  border: none;
  background: #f2f2f2;
  color: #333;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  margin-left: 12px;
}

.pdf-modal__close:hover {
  background: #e6e6e6;
}

.pdf-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: #6b7280;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.pdf-modal__body canvas,
.pdf-modal__body img {
  display: block;
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  background: #fff;
}

.pdf-modal__body img {
  width: 100%;
}

.pdf-loading {
  color: #fff;
  font-size: 14px;
  padding: 40px 0;
}

.pdf-modal__footer {
  flex: 0 0 auto;
  padding: 14px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: center;
}

.pdf-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1e6dff;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  text-decoration: none;
}

.pdf-download-btn:hover {
  background: #1656c9;
}
