/* トヨタマさんのキャラクターページ（デモ）
   地は白と濃い灰の2色に絞り、キャラの赤を立てる（Ribbit を改変）
   区画は1つずつ全画面にし、スクロールで全画面から全画面へ切り替える */

:root {
  --wall: #eef0ef;
  --concrete: #2e3134;
  --ink: #1a1c1e;
  --red: #d7261e;
  --gold: #c49a2c;
  --tape: #f4f1e2;
  --font-display: 'Dela Gothic One', 'Noto Sans JP', sans-serif;
  --font-body: 'Noto Sans JP', sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* スクロールを区画の頭で必ず止め、全画面から全画面へ切り替える */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  caret-color: var(--red);
}

::selection {
  background: var(--red);
  color: #fff;
}

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

a:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

p,
h1,
h2 {
  text-wrap: pretty;
  word-break: auto-phrase;
}

/* ── 上部のナビ 区画の上に固定して重ねる ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--concrete);
  color: #fff;
}

.site-logo {
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

/* 部署のロゴ。会社のマーク（白抜き）の右に、会社名と「キャラクターお楽しみ部」を2段で置く。
   部署名はテープのメニューと同じ赤い帯に載せ、少し傾けて、壁に貼ったステッカーに見せる */
.dept-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.dept-logo-mark {
  width: auto;
  height: 44px;
}

.dept-logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.1;
}

.dept-logo-co {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dept-logo-name {
  padding: 2px 8px 3px;
  background: var(--red);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  transform: rotate(-2deg);
  word-break: keep-all;
}

@media (max-width: 759px) {
  .dept-logo-mark {
    height: 36px;
  }

  .dept-logo-name {
    font-size: 14px;
  }
}

.site-nav ul {
  display: flex;
  gap: clamp(12px, 2vw, 28px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: #d9dcdc;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

/* ── 後ろに固定した全画面のグラフィティの風景 ──
   background-attachment: fixed は Apple の端末で効かないので、固定の層にする */
.scene-stack {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--concrete);
}

/* 区画が替わると、背景の層が重なりながら入れ替わる */
.scene-bg {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 560ms cubic-bezier(0.6, 0, 0.3, 1);
}

.scene-bg.is-current {
  opacity: 1;
}

.scene-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* PC用はキャラが右にいるので、狭い画面でも右を残す */
  object-position: 70% 50%;
}

/* ── 全画面の区画 ── */
.screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100svh;
  padding: calc(var(--header-h) + 24px) var(--gutter) 24px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* 背景の上に重ねる板 */
.panel-light {
  background: rgba(238, 240, 239, 0.94);
  border-radius: 6px;
  padding: clamp(20px, 3vw, 40px);
}

.screen-panel {
  width: min(1200px, 100%);
  padding: clamp(24px, 4vw, 56px) clamp(20px, 4vw, 56px);
  border-radius: 6px;
}

/* ── 最初の画面 ── */
.hero {
  align-items: stretch;
  gap: 24px;
}

.hero-words {
  max-width: 560px;
  min-width: 0;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
}

.hero-line {
  display: block;
}

/* 板の内側の幅（最大480px）に6文字が1行で収まる大きさ。76px×6字＝456px */
.hero-name {
  color: var(--red);
  font-size: clamp(40px, 5.2vw, 76px);
  word-break: keep-all;
  white-space: nowrap;
}

/* 10文字の名前。板の内側の幅（最大480px）に1行で収める。46px×10字＝460px */
.hero-name--long {
  font-size: clamp(24px, 3.4vw, 46px);
}

.hero-lead {
  max-width: 34em;
  margin: 20px 0 0;
}

/* コンテンツのメニュー 壁に貼ったテープの形（GYRE のラベルを改変） */
/* 右手の親指が届きやすいよう、メニューは右寄せにする */
.content-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: flex-end;
  gap: 14px;
}

.menu-tape {
  display: inline-block;
  padding: 10px 22px;
  background: var(--tape);
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(16px, 1.6vw, 20px);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(30, 30, 30, 0.18);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color 220ms;
}

.menu-tape:nth-child(2) {
  --tilt: 1.2deg;
}

.menu-tape:nth-child(3) {
  --tilt: -0.8deg;
  background: var(--red);
  color: #fff;
}

.menu-tape:hover,
.menu-tape:focus-visible,
.menu-tape.is-active {
  transform: rotate(0deg) translateX(-8px);
}

/* ── 走って出てくるトヨタマさん ── */
.runner {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  width: clamp(120px, 14vw, 200px);
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}

/* ── 見出し ── */
.section-title {
  margin: 0 0 24px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.2;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ── 紹介 ── */
.intro {
  background: rgba(46, 49, 52, 0.96);
  color: #fff;
}

.intro-body {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(20px, 4vw, 64px);
  align-items: start;
}

.intro-face {
  width: 100%;
  max-width: 320px;
}

.intro-text p {
  max-width: 36em;
  margin: 0 0 12px;
}

.traits {
  margin: 24px 0 0;
}

.traits div {
  display: grid;
  grid-template-columns: 8em minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.traits dt {
  color: var(--gold);
  font-weight: 700;
}

.traits dd {
  margin: 0;
  text-wrap: balance;
  word-break: auto-phrase;
}

/* ── スタンプ40個 正面から1枚ずつ見せる。PCは1画面に10列×4段で全部入れる ── */
.stickers {
  background: rgba(238, 240, 239, 0.96);
}

.stickers-lead {
  margin: -12px 0 20px;
}

.swipe-hint {
  display: none;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sticker-grid li {
  padding: 4px;
  background: #fff;
  border-radius: 10px;
}

/* ── 買う ── */
.buy {
  background: rgba(215, 38, 30, 0.96);
  color: #fff;
}

.buy p {
  max-width: 36em;
}

.buy-link {
  display: inline-block;
  margin-top: 16px;
  padding: 16px 32px;
  background: #fff;
  color: var(--red);
  font-weight: 900;
  font-size: 18px;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
}

/* 販売中のスタンプの一覧 1行1商品。商品名、種類と個数と価格、ストアへの入口 */
.product-list {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'title link'
    'meta  link';
  align-items: center;
  gap: 2px 20px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.product-title {
  grid-area: title;
  font-weight: 900;
  font-size: 18px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.product-meta {
  grid-area: meta;
  font-size: 14px;
  opacity: 0.9;
}

.product .buy-link {
  grid-area: link;
  margin: 0;
  padding: 10px 20px;
  font-size: 15px;
}

/* ストアへの入口の文字 PCは「LINE STOREで見る」、スマホは「見る」 */
.label-sp {
  display: none;
}

.product-group-title {
  margin: 20px 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.other-products {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.other-products a {
  color: #fff;
  text-underline-offset: 3px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* フッターは最後の画面の下端に止める */
.site-footer {
  padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  background: var(--concrete);
  color: #c9cccc;
  font-size: 13px;
  scroll-snap-align: end;
}

.site-footer p {
  margin: 0 0 4px;
}

/* トップへ戻る ファーストビューを過ぎたら出す */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 25;
  padding: 10px 16px;
  background: var(--concrete);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms;
}

.to-top.is-shown {
  opacity: 1;
  pointer-events: auto;
}

/* PCで画面の高さが低いときは、スタンプの列を増やして1画面に収める */
@media (min-width: 760px) and (max-height: 760px) {
  .sticker-grid {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }
}

/* ── スマホ ── */
@media (max-width: 759px) {
  :root {
    --header-h: 96px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 6px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .site-nav {
    width: 100%;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0 clamp(6px, 2vw, 16px);
  }

  .site-nav a {
    font-size: clamp(11px, 3.4vw, 13px);
    white-space: nowrap;
  }

  /* スマホ用の背景はキャラが上寄りなので、文字の板とメニューは下に寄せる */
  .scene-bg img {
    object-position: 50% 30%;
  }

  .hero {
    justify-content: flex-end;
    gap: 14px;
  }

  .panel-light {
    padding: 16px 20px;
  }

  .hero-lead {
    margin-top: 8px;
    font-size: 14px;
  }

  .menu-tape {
    padding: 8px 18px;
  }

  .screen-panel {
    padding: 24px 20px;
  }

  /* 1画面に収めるため、スマホでは見出しを小さくし、紹介の絵は外す（背景にトヨタマさんが大きく出ている） */
  .section-title {
    margin-bottom: 16px;
    font-size: 24px;
  }

  .intro-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .intro-face {
    display: none;
  }

  .intro-text {
    font-size: 15px;
    line-height: 1.7;
  }

  .traits {
    margin-top: 12px;
  }

  .traits div {
    padding: 8px 0;
  }

  /* 1画面に収めるため、スマホでは行を詰め、ボタンを行の右に小さく置く */
  .product {
    gap: 0 12px;
    padding: 10px 0;
  }

  .product-title {
    font-size: 15px;
    line-height: 1.5;
  }

  .product-meta {
    font-size: 13px;
  }

  .product .buy-link {
    position: relative;
    padding: 8px 16px;
    font-size: 14px;
  }

  .label-pc {
    display: none;
  }

  .label-sp {
    display: inline;
  }

  .traits div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  /* スマホでは40個を2段の横送りにして、1画面に収める */
  .swipe-hint {
    display: inline;
  }

  .sticker-grid {
    grid-template-columns: none;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: 38%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .sticker-grid li {
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .menu-tape {
    transition: none;
  }

  .runner {
    display: none;
  }

  .scene-bg {
    transition: none;
  }
}
