/* ===== Stage：常に画面いっぱい ===== */
.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #e5eff0;
  color: #1a1a1a;
  -webkit-text-size-adjust: 100%;
}

/* ===== 比率固定のデザイン領域（中の cqw = 1u） ===== */
.canvas {
  position: absolute;
  left: calc((100vw - min(100vw, 156.87dvh)) / 2);
  top: 0;
  width: min(100vw, 156.87dvh);
  height: min(63.75vw, 100.0046dvh);
  container-type: inline-size;
}

/* ===== Title ===== */
.canvas .title { position: absolute; inset: 0 0 auto 0; text-align: center; }

.title__ja {
  position: absolute; left: 0; right: 0; top: 9.8cqw;
  font: 900 min(1.25vw, 1.9609dvh)/1 "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif !important;
  letter-spacing: .12em;
}
.title__en {
  color: var(--wpex-table-th-color);
  margin: 0;
  position: absolute; left: 0; right: 0; top: 13.1cqw;
  font: 800 min(3.5vw, 5.4905dvh)/1.2 "Montserrat", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: .08em;
  word-spacing: .15em;
}
.title__year {
  position: absolute; left: 0; right: 0; top: 18.1cqw;
  font: 800 min(2vw, 3.1374dvh)/1 "Montserrat", "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: .1em;
}

.bubble { position: absolute; border-radius: 50%; background: #9fcddb; }
.bubble--l { left: 67.2cqw; top: -3.6cqw; width: 1.5cqw; height: 1.2cqw; }
.bubble--m { left: 68.5cqw; top: -1.6cqw; width: .8cqw;  height: .8cqw; }
.bubble--s { left: 67.4cqw; top: -.7cqw;  width: .35cqw; height: .35cqw; }

.pc_lead_box .title {
  position: static;
}

.pc_lead_box .title__en {
  position: relative;
  margin: 30px 0 var(--wpex-el-margin-bottom);
  display: inline-block;
  top: auto; left: auto; right: auto;
}

.pc_lead_box .title__ja, .pc_lead_box .title__year {
  position: static;
}

.pc_lead_box p {
    color: var(--wpex-table-th-color);
    margin-block-end: auto;
}

.pc_lead_box .bubble--l { left: auto; right: .54em; top: -1.03em; width: .43em; height: .34em; }
.pc_lead_box .bubble--m { left: auto; right: .37em; top: -.46em;  width: .23em; height: .23em; }
.pc_lead_box .bubble--s { left: auto; right: .81em; top: -.2em;   width: .1em;  height: .1em; }


/* ===== PHOTO（写真で文字を抜く） ===== */
.photo-word {
  position: absolute; inset: 0;
  padding: 24.6cqw 0 0 11.3cqw;
  font: 900 14.4cqw/1 "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", sans-serif;
  letter-spacing: .01em;
  color: transparent;
  background-image: url("/wp/wp-content/themes/color-child/images/page/photo-contest-2027/main.webp");
  background-repeat: no-repeat;
  background-size: max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) auto;
  background-position: calc(-0.5 * max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) + min(52.9vw, 82.9842dvh)) min(3.8vw, 5.9611dvh);
  -webkit-background-clip: text;
          background-clip: text;
}

/* ===== 募集期間 ===== */
.period { position: absolute; left: 63.6cqw; top: 27.2cqw; }
.period__label {
  font: 900 1.45cqw/1 "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  letter-spacing: .1em;
  margin-bottom: auto;
}
.period__label span { font: 800 1.1cqw/1 "Montserrat", "Helvetica Neue", Arial, sans-serif; letter-spacing: .08em;}

.period__date {
  display: flex; align-items: flex-end;
  margin-top: .9cqw;
  white-space: nowrap;
}
.period__date .num {
  font: 900 4.8cqw/1 "Montserrat", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .04em;
}
.period__date .day {
  writing-mode: vertical-rl;
  font: 800 1cqw/1 "Montserrat", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .08em;
  margin: 0 0 .35cqw .2cqw;
  align-self: flex-start;
  position: relative;
  top: 10px;
}
.period__date .dash {
  width: 1.5cqw; height: .22cqw;
  background: #1a1a1a;
  margin: 0 1.1cqw 1.6cqw 1.1cqw;
}

/* ===== 下部の写真：画面の左右・下端まで全幅 ===== */
.photo {
  position: absolute; left: 0; right: 0; bottom: 0;
  top: min(36.4vw, 57.1007dvh);
  background-image: url("/wp/wp-content/themes/color-child/images/page/photo-contest-2027/main.webp");
  background-repeat: no-repeat;
  background-size: max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) auto;
  background-position:
    calc(50vw - 0.5 * max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) + min(2.9vw, 4.5492dvh))
    max(-32.6vw, -51.1396dvh);
}

/* =====================================================
   スマホ横向き（高さが低い横長）：写真エリアに子どもの顔が入るよう画像を上へ寄せる
   ===================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  .photo-word { background-position: calc(-0.5 * max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) + min(52.9vw, 82.9842dvh)) max(-13vw, -20.3931dvh); }
  .photo      { background-position: calc(50vw - 0.5 * max(min(113.2vw, 177.5768dvh), calc(100vw + min(5.8vw, 9.0985dvh)), calc(150dvh - min(5.7vw, 8.9416dvh))) + min(2.9vw, 4.5492dvh)) max(-49.4vw, -77.4938dvh); }
}

/* =====================================================
   縦長の画面・スマホ：縦積みで全画面
   ===================================================== */
@media (max-aspect-ratio: 1/1), (max-width: 600px) {

  .stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: env(safe-area-inset-top);
  }
  .canvas { display: contents; container-type: normal; }

  /* タイトル：余った高さの中で中央配置 */
  .canvas .title {
    position: relative; inset: auto; order: 1;
    flex: 1 1 auto; width: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: min(4vw, 1.96dvh);
    /* 上：ヘッダーの高さ(84px)＋元の余白 / 左右・下：元のまま */
    padding: calc(84px + min(2vw, 0.98dvh)) min(4vw, 1.96dvh) min(2vw, 0.98dvh);
  }
  .title__ja   { position: static; font-size: min(3.6vw, 1.764dvh) !important; }
  .title__en   { position: relative; inset: auto; font-size: min(7.4vw, 3.626dvh) !important; letter-spacing: .04em; }
  .title__year { position: static; font-size: min(5vw, 2.45dvh) !important; }
  .bubble--l { left: auto; right: max(-3vw, -1.47dvh);   top: max(-8.5vw, -4.165dvh); width: min(4vw, 1.96dvh);   height: min(3.2vw, 1.568dvh); }
  .bubble--m { left: auto; right: max(-6.5vw, -3.185dvh); top: max(-3.6vw, -1.764dvh); width: min(2.2vw, 1.078dvh); height: min(2.2vw, 1.078dvh); }
  .bubble--s { left: auto; right: max(-3.2vw, -1.568dvh); top: max(-1.4vw, -0.686dvh); width: min(0.9vw, 0.441dvh);  height: min(0.9vw, 0.441dvh); }

  /* 募集期間 */
  .period { position: static; order: 2; flex: none; text-align: center; margin-bottom: min(7vw, 3.43dvh); }
  .period__label { font-size: min(4vw, 1.96dvh); }
  .period__label span { font-size: min(3.2vw, 1.568dvh); }
  .period__date { justify-content: center; margin-top: min(2.4vw, 1.176dvh); }
  .period__date .num { font-size: min(13.5vw, 6.615dvh); }
  .period__date .day { font-size: min(2.8vw, 1.372dvh); margin: 0 0 min(1vw, 0.49dvh) min(0.6vw, 0.294dvh); }
  .period__date .dash { width: min(4.2vw, 2.058dvh); height: min(0.7vw, 0.343dvh); margin: 0 min(3vw, 1.47dvh) min(4.6vw, 2.254dvh); }

  /* PHOTO 文字 */
  .photo-word {
    position: relative; inset: auto; order: 3; flex: none;
    width: 100%; height: min(26vw, 12.74dvh);
    padding: 0;
    text-align: center;
    font-size: min(26vw, 12.74dvh);
    background-size: max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))) auto;
    background-position: calc(-0.68 * (max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))) - 100vw)) calc(-0.18 * max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))));
  }

  /* 写真（文字下端とつながる） */
  .photo {
    position: relative; inset: auto; order: 4; flex: none;
    width: 100%; height: max(56vw, 40dvh);
    margin-top: max(-3.1vw, -1.519dvh);
    background-size: max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))) auto;
    background-position:
      calc(-0.68 * (max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))) - 100vw))
      calc(-0.18 * max(130vw, calc(2.0548 * (min(26vw, 12.74dvh) - min(3.1vw, 1.519dvh) + max(56vw, 40dvh)))) - min(26vw, 12.74dvh) + min(3.1vw, 1.519dvh));
  }
  .pc_lead_box .title {
    padding: min(6vw, 2.94dvh) min(4vw, 1.96dvh) min(2vw, 0.98dvh);
  }

  .pc_lead_box .title__en {
    margin: 20px 0 5px;
  }
}
