/* ============================================================
   レモンチ公式サイト / 2D版 ピクセルアクセント
   面・本文・カードの基礎は style.css。装飾は提供素材だけを使う。
   ============================================================ */

@font-face {
  font-family: "PixelMplus12";
  src: url("../fonts/PixelMplus12-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --pixel-grid: 4px;
  --pixel-section-band: 56px;
  --mobile-safe-top: max(12px, env(safe-area-inset-top));
  --mobile-safe-right: max(12px, env(safe-area-inset-right));
}

/* ---------- 2D⇄3D切替アイコン ---------- */
.mode-switch {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 130;
  width: 104px;
  height: 104px;
  min-height: 104px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  text-decoration: none;
  transition: transform 120ms steps(1, end);
}

.mode-switch__icon {
  width: 96px;
  height: 96px;
  display: block;
  object-fit: contain;
  background: transparent;
  image-rendering: auto;
  filter:
    drop-shadow(1px 0 0 var(--white))
    drop-shadow(-1px 0 0 var(--white))
    drop-shadow(0 1px 0 var(--white))
    drop-shadow(0 -1px 0 var(--white));
}

.mode-switch__label {
  position: absolute;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  display: block;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-shadow:
    1px 0 0 var(--white),
    -1px 0 0 var(--white),
    0 1px 0 var(--white),
    0 -1px 0 var(--white);
  white-space: nowrap;
}

.mode-switch:hover,
.mode-switch:focus-visible {
  background: transparent;
  color: var(--ink);
  outline-color: var(--accent-dark);
  transform: translate(2px, 2px);
}

.mode-switch:active,
.mode-switch.is-pressed {
  transform: translate(4px, 4px);
}

/* ---------- NOW LOADING ---------- */
.now-loading {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: none;
  place-items: center;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  pointer-events: none;
}

.now-loading.is-active {
  display: grid;
}

.now-loading.is-active.is-released {
  animation: now-loading-cut 1ms steps(1, end) forwards;
}

.now-loading__panel {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 28px 26px;
  border: 2px solid var(--accent-dark);
  background: var(--white);
  box-shadow: 4px 4px 0 var(--accent-dark);
}

.now-loading__title {
  color: var(--accent-dark);
  font-family: "PixelMplus12", monospace;
  font-size: 25px;
  letter-spacing: 0.08em;
  line-height: 1;
}

.now-loading__progress {
  display: flex;
  align-items: center;
  gap: 5px;
}

.now-loading__block {
  width: 15px;
  height: 15px;
  display: block;
  background: var(--yellow);
  image-rendering: pixelated;
  opacity: 0.26;
  animation: now-loading-block-light 900ms steps(1, end) infinite;
}

.now-loading__block:nth-child(2) { animation-delay: 112ms; }
.now-loading__block:nth-child(3) { animation-delay: 224ms; }
.now-loading__block:nth-child(4) { animation-delay: 336ms; }
.now-loading__block:nth-child(5) { animation-delay: 448ms; }
.now-loading__block:nth-child(6) { animation-delay: 560ms; }
.now-loading__block:nth-child(7) { animation-delay: 672ms; }
.now-loading__block:nth-child(8) { animation-delay: 784ms; }

.now-loading__runner {
  position: absolute;
  right: 24px;
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 32px;
  height: 32px;
  display: block;
  background: url("../images/px/stock/native/lemon.png") center / contain no-repeat;
  image-rendering: pixelated;
  animation: now-loading-bounce 360ms steps(2, end) infinite;
}

@keyframes now-loading-block-light {
  0%,
  11% {
    opacity: 0.26;
    transform: translateY(0);
  }

  12%,
  100% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes now-loading-bounce {
  0%,
  100% { transform: translateY(0); }

  50% { transform: translateY(-8px); }
}

@keyframes now-loading-cut {
  0% { visibility: visible; }
  100% { visibility: hidden; }
}

/* ---------- ヒーロー ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: var(--paper);
  background-image: none;
}

.hero__decor {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero__castle-picture {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.hero__castle-scene {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: top center;
  image-rendering: pixelated;
}

.hero__inner {
  position: relative;
  z-index: 1;
  align-items: end;
}

.hero__copy {
  position: relative;
  z-index: 3;
  isolation: isolate;
  padding: 16px 18px 22px;
  margin: -16px -18px -22px;
  grid-column: 1;
  grid-row: 1;
}

.hero__copy::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: 20px;
  background: rgba(255, 253, 245, 0.9);
  content: "";
}

.hero__sprite-panel {
  position: relative;
  z-index: 2;
  align-self: end;
  transform: none;
  pointer-events: none;
  grid-column: 2;
  grid-row: 1;
}

.hero__sprite-viewport {
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  image-rendering: pixelated;
}

.hero__sprite {
  position: relative;
  z-index: 2;
  image-rendering: pixelated;
  transform-origin: 50% 100%;
  animation: remonchi-hop 0.8s steps(1, end) infinite;
}

.hero__stock-float {
  position: absolute;
  z-index: 1;
  top: 30%;
  right: max(14px, calc((100vw - var(--content-width)) / 2 - 58px));
  width: 39px;
  height: 39px;
  display: block;
  background: url("../images/px/stock/native/kirakira_01_lightyellow.png") center / 39px 39px no-repeat;
  image-rendering: pixelated;
  opacity: 0.82;
  animation: stock-float-drift 10s steps(8, end) infinite;
  pointer-events: none;
}

@keyframes remonchi-hop {
  0% { transform: translateY(0) scale(1.03, 0.97); }
  50% { transform: translateY(-12px) scale(0.99, 1.03); }
  100% { transform: translateY(0) scale(1.03, 0.97); }
}

/* ---------- 3D入口 ---------- */
.world-door {
  position: relative;
  z-index: 4;
  width: min(100%, 420px);
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 6px 10px;
  border: 2px solid var(--accent-dark);
  background: transparent;
  color: var(--accent-dark);
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--accent-dark);
  transition: background-color 120ms steps(1, end), color 120ms steps(1, end), transform 120ms steps(1, end), box-shadow 120ms steps(1, end);
}

.world-door__glyph {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.world-door__copy {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  line-height: 1.35;
}

.world-door__copy strong {
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 900;
}

.world-door__copy small {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

.world-door__arrow {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 16px;
  line-height: 1;
  animation: world-door-arrow 1.2s steps(2, end) infinite;
}

@keyframes world-door-arrow {
  0%,
  49.999% { transform: translateX(0); }
  50%,
  100% { transform: translateX(var(--pixel-grid)); }
}

.world-door:hover,
.world-door:focus-visible {
  background: var(--yellow);
  color: var(--ink);
  outline-color: var(--accent-dark);
  transform: translate(var(--pixel-grid), var(--pixel-grid));
  box-shadow: none;
}

/* ---------- セクションの仕切りと提供素材 ---------- */
.section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 72px;
}

.section__pixel-layer {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.section__inner {
  position: relative;
  z-index: 2;
}

.section__ribbon {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  left: 0;
  height: var(--pixel-section-band);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(4px, 1.2vw, 18px);
  overflow: hidden;
  padding: 0 clamp(8px, 2vw, 26px);
  border-top: 1px solid rgba(29, 122, 77, 0.12);
  border-bottom: 3px solid rgba(29, 122, 77, 0.2);
  background: rgba(255, 255, 255, 0.78);
}

.section__ribbon > img {
  flex: 0 0 auto;
  width: auto;
  height: auto;
  max-width: none;
  object-fit: contain;
  image-rendering: pixelated;
}

.section__ribbon > img[src$="native/weather_cloudy_white.png"] {
  width: 32px;
  height: 22px;
}

.section__ribbon > img[src$="native/kirakira_01_lightyellow.png"] {
  width: 39px;
  height: 39px;
}

.section__ribbon > img[src$="native/ashiato_pink.png"] {
  width: 51px;
  height: 39px;
}

.section__ribbon > img[src$="native/dog_shihtzu_01_white.png"] {
  width: 40px;
  height: 26px;
}

.section__ribbon > img[src$="native/momiji_red.png"],
.section__ribbon > img[src$="native/momiji_yellow.png"] {
  width: 39px;
  height: 48px;
}

.section__ribbon > img[src$="native/drink_lemonsquash_straw.png"] {
  width: 26px;
  height: 36px;
}

.section__ribbon > img[src$="native/kakigori_lemon.png"] {
  width: 28px;
  height: 30px;
}

.section__ribbon > img[src$="native/lemon.png"] {
  width: 45px;
  height: 36px;
}

.section__ribbon > img[src$="native/lemon_cut.png"] {
  width: 42px;
  height: 42px;
}

.section__ribbon--news { border-bottom-color: rgba(74, 157, 191, 0.34); }
.section__ribbon--profile { border-bottom-color: rgba(244, 164, 164, 0.42); }
.section__ribbon--event { border-bottom-color: rgba(192, 57, 53, 0.3); }
.section__ribbon--movie { border-bottom-color: rgba(232, 184, 32, 0.4); }
.section__ribbon--goods { border-bottom-color: rgba(29, 122, 77, 0.28); }

.stock-float {
  position: absolute;
  z-index: 0;
  width: 39px;
  height: 39px;
  display: block;
  background: url("../images/px/stock/native/kirakira_01_lightyellow.png") center / 39px 39px no-repeat;
  image-rendering: pixelated;
  opacity: 0.82;
  animation: stock-float-drift 12s steps(8, end) infinite;
  pointer-events: none;
}

.section__float--profile-sparkle {
  top: 72px;
  right: max(14px, calc((100vw - var(--content-width)) / 2 - 58px));
  animation-delay: -3s;
}

.section__float--movie-sparkle {
  right: max(14px, calc((100vw - var(--content-width)) / 2 - 58px));
  bottom: 74px;
  animation-delay: -2s;
}

@keyframes stock-float-drift {
  0%,
  100% { transform: translate(0, 0); }
  50% { transform: translate(4px, -6px); }
}

/* ---------- 見出しのドット下線 ---------- */
.section__title {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.section__title::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--pixel-grid);
  background: repeating-linear-gradient(
    90deg,
    var(--accent-dark) 0 var(--pixel-grid),
    transparent var(--pixel-grid) calc(var(--pixel-grid) * 2)
  );
  content: "";
}

.section__title.is-reveal-pending::after {
  clip-path: inset(0 100% 0 0);
}

.section__title.is-reveal-pending.is-in-view::after {
  animation: pixel-title-reveal 480ms steps(8, end) forwards;
}

@keyframes pixel-title-reveal {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.section__title > img,
.section__title > .section__icon,
.section__title > .section__title-icon {
  image-rendering: pixelated;
}

/* ---------- 背景の色を固定する ---------- */
body {
  background-color: var(--paper);
  background-image: none;
}

.site-header,
.profile__img {
  background-color: var(--white);
  background-image: none;
}

.section.section--topics,
.section.section--news,
.section.section--event,
.section.section--goods {
  background-color: var(--paper);
  background-image: url("../images/px/stock/native/pattern-b.png");
  background-position: 0 0;
  background-size: 96px 96px;
  background-repeat: repeat;
  image-rendering: pixelated;
}

.section.section--profile,
.section.section--movie {
  background-color: var(--white);
  background-image: none;
}

/* ---------- スクロール時のお供レモンチ ---------- */
.companion {
  position: fixed;
  top: auto;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: auto;
  z-index: 200;
  width: 176px;
  height: 176px;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  appearance: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.42s ease,
    transform 0.42s ease,
    visibility 0s linear 0.42s;
}

.companion.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0s;
}

.companion:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
}

.companion img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transform: none;
}

.companion.is-visible img {
  animation: companion-hop 0.9s steps(2, end) infinite;
}

@keyframes companion-hop {
  0%,
  100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------- 紅葉のレイヤー ---------- */
.momiji-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero > .momiji-layer--hero {
  z-index: 4;
}

.section > .momiji-layer--content {
  z-index: 1;
}

.momiji {
  position: absolute;
  top: -64px;
  left: var(--momiji-lane);
  width: var(--momiji-width);
  height: var(--momiji-height);
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  image-rendering: pixelated;
  opacity: 0.55;
  animation: momiji-fall var(--momiji-duration) steps(16, end) var(--momiji-delay) infinite;
  will-change: transform, opacity;
}

.momiji--red {
  background-image: url("../images/px/stock/native/momiji_red.png");
}

.momiji--yellow {
  background-image: url("../images/px/stock/native/momiji_yellow.png");
}

@keyframes momiji-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -8vh, 0) rotate(0deg);
  }

  8% {
    opacity: 0.55;
  }

  50% {
    opacity: 0.55;
    transform: translate3d(var(--momiji-drift), 48vh, 0) rotate(180deg);
  }

  92% {
    opacity: 0.55;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--momiji-drift-end), 112vh, 0) rotate(360deg);
  }
}

/* ---------- SP: ハンバーガー→切替アイコンの縦並び ---------- */
@media (max-width: 760px) {
  .site-nav-toggle {
    top: var(--mobile-safe-top);
    right: var(--mobile-safe-right);
  }

  .site-nav {
    top: calc(var(--mobile-safe-top) + 136px);
    right: var(--mobile-safe-right);
  }

  .mode-switch {
    top: calc(var(--mobile-safe-top) + 58px);
    right: -11px; /* eRCC調整(2026-09) */
    width: 88px;
    height: 88px;
    min-height: 88px;
    padding: 4px;
  }

  .mode-switch__icon {
    width: 80px;
    height: 80px;
  }

  .mode-switch__label {
    top: calc(100% - 1px);
    font-size: 10px;
  }

  /* v2.10: 城を上段の帯、本文を下段のクリーム地に分ける。 */
  .hero {
    --hero-image-height: 58vh;
    --hero-sprite-size: clamp(112px, 31vw, 128px);
    min-height: 0;
    padding: 0 16px 48px;
  }

  .hero__decor {
    inset: 0 0 auto;
    height: var(--hero-image-height);
  }

  .hero__inner {
    min-height: 0;
    display: block;
  }

  .hero__copy {
    max-width: none;
    padding: calc(var(--hero-image-height) + 24px) 0 0;
    margin: 0;
  }

  /* SP: 城の画像帯は紙面レイヤーで覆わず、画像を素の彩度で見せる。 */
  .hero__copy::before {
    display: none;
  }

  .hero__copy h1 {
    position: absolute;
    top: clamp(12px, 2.4vh, 20px);
    left: 0;
    width: fit-content;
    max-width: calc(100% - var(--hero-sprite-size) - 12px);
    font-size: clamp(18px, 5.4vw, 24px);
    line-height: 1.2;
    isolation: isolate;
  }

  .hero__copy h1::before {
    position: absolute;
    z-index: -1;
    inset: -8px;
    background: rgba(255, 253, 245, 0.55);
    content: "";
    pointer-events: none;
  }

  .hero__copy h1,
  .hero__copy h1 span {
    text-shadow:
      1px 0 0 var(--white),
      -1px 0 0 var(--white),
      0 1px 0 var(--white),
      0 -1px 0 var(--white);
  }

  .hero p {
    margin-top: 0;
    text-shadow: none;
  }

  .hero__sprite-panel {
    position: absolute;
    z-index: 4;
    top: calc(45.2vh - var(--hero-sprite-size));
    right: 0;
    bottom: auto;
    width: var(--hero-sprite-size);
    align-self: auto;
    margin: 0;
  }

  .hero__sprite-viewport {
    width: 100%;
  }

  .hero__cta {
    display: flex;
    width: fit-content;
    max-width: 100%;
  }

  .hero__sns {
    width: min(100%, 420px);
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
  }

  .sns-btn {
    width: 100%;
    justify-content: center;
  }

  .world-door {
    width: min(100%, 420px);
    margin-top: 14px;
    background: var(--white);
    border-color: var(--accent-dark);
    box-shadow: 2px 2px 0 var(--accent-dark);
  }

  .section {
    padding-top: 72px;
  }

  .section__ribbon {
    height: var(--pixel-section-band);
    gap: 4px;
    padding: 0 6px;
  }

  .section__ribbon--profile > img:nth-child(n + 7),
  .section__ribbon--event > img:nth-child(n + 6),
  .section__ribbon--movie > img:nth-child(n + 5),
  .section__ribbon--goods > img:nth-child(n + 5) {
    display: none;
  }

  .companion {
    width: 128px;
    height: 128px;
  }

  .momiji {
    animation-timing-function: steps(12, end);
  }
}

@media (prefers-reduced-motion: reduce) {
  .now-loading {
    display: none !important;
  }

  .now-loading__block,
  .now-loading__runner,
  .hero__sprite,
  .world-door__arrow,
  .hero__stock-float,
  .stock-float,
  .section__title::after,
  .companion,
  .companion.is-visible,
  .companion.is-visible img,
  .momiji {
    animation: none !important;
    animation-play-state: paused !important;
    transition: none !important;
  }

  .momiji-layer {
    display: none !important;
  }

  .companion,
  .companion.is-visible {
    transform: none;
  }

  .section__title.is-reveal-pending::after {
    clip-path: none !important;
  }
}

/* ---------- フッターの提供タイル ---------- */
.site-footer {
  position: relative;
  padding-top: 76px;
}

.site-footer::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 44px;
  border-bottom: 3px solid rgba(255, 216, 61, 0.65);
  background-color: var(--paper);
  background-image: url("../images/px/stock/native/maptile_sogen_hana_02.png");
  background-position: center;
  background-size: 48px 48px;
  background-repeat: repeat;
  content: "";
  image-rendering: pixelated;
  opacity: 0.84;
}

@media (max-width: 760px) {
  .site-footer {
    padding-top: 68px;
  }

  .site-footer::before {
    height: 48px;
    background-size: 48px 48px;
  }
}
