/* WARPIX製作所：青空・白い雲・町工場。なつかしい トタンと、未来の 光 */
/* ふだんの 文字は この サイトに おいた DotGothic16（つかう 文字だけ。node tools/fonts.mjs）。OFL：fonts/OFL-DotGothic16.txt */
@font-face {
  font-family: "DotGothic16";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/dotgothic16.woff2?v=abeda620") format("woff2");
}

:root {
  --sky-hi: #3d9bf0;
  --sky: #5fb2f7;
  --sky-lo: #bfe4ff;
  --page: #efe7d2; /* じめんの 色 */
  --paper: #fff8e7;
  --ink: #2b2f3a;
  --red: #b8361f; /* 文字に つかえる 赤 */
  --navy: #24406b;
  --green: #1d6b3a;
  --muted: #5c5446;
  --yellow: #ffd84a;
  --cyan: #1aa6c4;
  --wood: #a8713f;
  --px: 4px;
  --w: min(1120px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  background: #7b5236; /* 地面の 下の 土（絵が でる まで） */
  color: var(--ink);
  font-family: "DotGothic16", "Press Start 2P", monospace;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: none;
  overflow-x: hidden;
}

canvas {
  image-rendering: pixelated;
}

a {
  color: var(--navy);
}

:focus-visible {
  outline: var(--px) solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 calc(var(--px) + 2px) var(--yellow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 30;
  padding: 8px 12px;
  background: var(--yellow);
  color: var(--ink);
}
.skip:focus {
  top: 16px;
}

/* ---------- 青空の 工場まち（画面いっぱい） ---------- */
.hero {
  background: var(--sky-hi);
}

.scene {
  position: relative;
  width: 100%;
  height: 352px;
  overflow: hidden;
  background: var(--page);
}
.scene canvas {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  display: block;
}

/* 屋上の 看板（文字は 絵ではなく、ほんものの 見出し。場所と 大きさは JS が あわせる） */
.sign {
  position: absolute;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  color: var(--red);
  font-family: "Press Start 2P", monospace;
  font-weight: normal;
  line-height: 1;
  white-space: nowrap;
}
.sign span {
  color: var(--navy);
  font-family: "DotGothic16", monospace;
  font-size: 1.15em;
}

/* くすだまの たれまく（開店いわい） */
.kaiten-tag {
  position: absolute;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red);
  font-family: "DotGothic16", monospace;
  line-height: 1;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  pointer-events: none;
}

/* おせる ところ（えんとつ・ゲンさん・ピクセ・ねこ）。すきとおった ボタンを 絵に かさねる */
.hot {
  position: absolute;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.hot[hidden] {
  display: none;
}

/* ふきだし（え の 一部。読み上げは #bubble が する） */
.say {
  position: absolute;
  width: max-content;
  max-width: min(78%, 360px);
  margin: 0;
  padding: 0.3em 0.7em;
  translate: -50% -100%;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 0 0 3px var(--ink), 4px 4px 0 3px var(--ink);
}
.say::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  border: 7px solid transparent;
  border-top-color: var(--ink);
  translate: -50% 3px;
}
.say:empty {
  display: none;
}
.say.edge-left {
  translate: -14% -100%;
}
.say.edge-left::after {
  left: 14%;
}
.say.edge-right {
  translate: -86% -100%;
}
.say.edge-right::after {
  left: 86%;
}

/* ---------- 地面の 下の 世界（JS が 絵を 描く） ---------- */
.underground {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.underground canvas {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  display: block;
}
main,
footer {
  position: relative;
  z-index: 1;
}
/* パネルの あいだの すきまは、地下の ボタンまで クリックが とどく */
main,
.cols,
.hollow {
  pointer-events: none;
}
main > *,
.cols > * {
  pointer-events: auto;
}
main > .cols,
main > .hollow {
  pointer-events: none;
}
.ug-hot {
  position: absolute;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
}
.ug-hot[hidden] {
  display: none;
}
/* 地下の ことばの まど */
.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 40;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 10px 16px;
  translate: -50% 0;
  background: #2a2033;
  color: #efe6d6;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-line;
  box-shadow: 0 0 0 3px #5ff0ff, 0 0 0 5px #140f1a;
}
.toast:empty {
  display: none;
}
/* のぞき窓（図鑑から 地下の 子に 会う。せまい 画面で 地下に いない とき） */
.nozoki {
  width: min(300px, calc(100vw - 32px));
  padding: 16px;
  border: 0;
  background: #2a2033;
  color: #efe6d6;
  box-shadow: 0 0 0 3px #5ff0ff, 0 0 0 5px #140f1a;
}
.nozoki::backdrop {
  background: rgba(20, 15, 26, 0.6);
}
.nozoki h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: normal;
}
.nozoki-view {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  box-shadow: 0 0 0 3px #140f1a;
}
.nozoki-view canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.nozoki-say {
  min-height: 3.2em;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}
.nozoki-close {
  display: block;
  margin-left: auto;
  padding: 6px 14px 4px;
  border: 0;
  background: #efe6d6;
  color: #2a2033;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
/* パネルの あいだの 空洞（ここに 地下の 生き物や 遺跡が 見える） */
.hollow {
  height: 150px;
}
.hollow.deep {
  height: 260px;
}
.hollow.core {
  position: relative;
  height: 320px;
  pointer-events: none;
}

/* 工場見学ツアー */
.tour-btn {
  position: absolute;
  right: 12px;
  top: 12px; /* 右上（おひさまの あたり）。下は なかまたちが いる */
  z-index: 2;
  padding: 8px 12px 6px;
  border: 0;
  background: var(--yellow);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--ink), 0 var(--px) 0 3px var(--ink);
}
.tour-btn:hover {
  background: #ffe680;
}
.touring .hot {
  display: none;
}
/* スマホ：絵を よこに うごかす（ゆびで ひっぱる・◀ ▶） */
.scene {
  touch-action: pan-y pinch-zoom;
}
.look {
  position: absolute;
  top: 46%;
  z-index: 2;
  width: 32px;
  height: 40px;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink);
}
.look-l {
  left: 6px;
}
.look-r {
  right: 6px;
}
.look[hidden],
.touring .look {
  display: none;
}
.say.narrate {
  top: auto !important;
  bottom: 14px;
  left: 50% !important;
  max-width: min(86%, 680px);
  translate: -50% 0;
  font-size: 16px;
}
.say.narrate.top {
  top: var(--top, 14px) !important;
  bottom: auto;
}
.say.narrate::after {
  display: none;
}
@media (max-width: 480px) {
  .say.narrate {
    font-size: 14px;
  }
}

/* ---------- 工場あんない・けいじばん ---------- */
main {
  width: var(--w);
  margin: 0 auto;
  padding: 20px 0 8px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 860px) {
  .topbar {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
}

.guide {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.guide a {
  padding: 8px 14px 6px;
  background: var(--wood);
  color: #fff;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 2px 2px 0 #6b4424;
  box-shadow: 0 0 0 2px var(--ink), 0 var(--px) 0 2px var(--ink);
}
.guide a:hover {
  background: #b98450;
}

.board {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  padding: 10px 14px;
  background: #285236; /* こくばん */
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0 0 var(--px) var(--wood), 0 0 0 calc(var(--px) + 2px) var(--ink);
}
.board-name {
  color: var(--yellow);
  font-size: 14px;
}
.board-latest {
  flex: 1 1 200px;
  font-size: 15px;
}
.board-latest .new {
  margin-right: 6px;
  color: #ffc2b8;
}

/* ひろい 画面では 2 れつ */
.cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 28px;
  align-items: start;
}
@media (min-width: 860px) {
  .cols {
    grid-template-columns: 1fr 1fr;
  }
  .cols #products {
    grid-column: 1 / -1;
  }
}

/* ---------- パネル ---------- */
.panel {
  margin-top: 40px;
  padding: 20px;
  background: var(--paper);
  box-shadow:
    0 0 0 var(--px) var(--ink),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 var(--px) rgba(43, 47, 58, 0.25);
  scroll-margin-top: 16px;
}
.panel:focus {
  outline: none;
}
.panel h2 {
  margin: 0 0 12px;
  padding-bottom: 6px;
  color: var(--red);
  font-size: 22px;
  font-weight: normal;
  border-bottom: var(--px) dashed var(--yellow);
}
.panel h3 {
  margin: 20px 0 4px;
  color: var(--navy);
  font-size: 17px;
  font-weight: normal;
}
.panel p {
  margin: 0 0 8px;
}
.lead {
  color: var(--muted);
}

.news {
  margin: 0;
  padding: 0;
  list-style: none;
}
.news li + li {
  margin-top: 12px;
}
.p-state {
  color: var(--green);
  font-size: 14px;
}
.lamp {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  background: var(--cyan);
}
.lamp.off {
  opacity: 0.25;
}
.ex-soon .p-state {
  color: var(--muted);
}

.news li {
  padding: 12px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--ink);
}
.news time {
  color: var(--muted);
  font-size: 14px;
}
.news .n-title {
  display: block;
  color: var(--navy);
  font-size: 16px;
  text-decoration: underline; /* リンクでは ないが、本文と 見わけが つく ように（v1.29.1） */
  text-underline-offset: 3px;
}
.news .n-body {
  margin: 4px 0 0;
  font-size: 15px;
}
.news .n-new {
  margin-left: 6px;
  color: var(--red);
  font-size: 13px;
}

/* ---------- せいひん 展示室 ---------- */
.exhibit {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--ink);
}
@media (min-width: 860px) {
  .exhibit {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 24px;
  }
}
.ex-side {
  align-self: start;
}
/* スマホでは 札を 紹介の あとに */
@media (max-width: 859px) {
  .ex-side {
    display: contents;
  }
  .ex-plate {
    order: 2;
    margin: 0;
  }
}
.ex-plate {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 20px 0 0;
  padding: 12px 14px;
  background: #f4efe2;
  font-size: 14px;
  box-shadow: 0 0 0 2px #c9bfa8;
}
.ex-plate dt {
  color: var(--navy);
}
.ex-plate dd {
  margin: 0;
}
.ex-shot {
  display: block;
  align-self: start;
  box-shadow: 0 0 0 3px var(--ink), 6px 6px 0 3px rgba(43, 47, 58, 0.25);
}
.ex-shot img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.ex-tarp {
  display: grid;
  place-items: center;
  aspect-ratio: 1200 / 420;
  background: repeating-linear-gradient(90deg, #3f7fd6 0 22px, #2f66b5 22px 26px);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  text-shadow: 3px 3px 0 #1d3f78;
}
.ex-no {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.ex-name {
  margin: 2px 0 6px;
  color: var(--navy);
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
  font-weight: normal;
  line-height: 1.5;
}
.panel .ex-catch {
  margin: 0 0 4px;
  font-size: 17px;
}
.panel .ex-what {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
}
.ex-list {
  margin: 0;
  padding-left: 1.3em;
  font-size: 15px;
}
.ex-list li {
  margin: 4px 0;
}
.ex-features b {
  color: var(--navy);
  font-weight: normal;
}
.ex-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin: 18px 0 0;
}
.ex-go {
  padding: 10px 16px 8px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 0 0 2px var(--ink), 0 var(--px) 0 2px var(--ink);
}
.ex-go:hover {
  background: #a02e1a;
}
/* ピクセの てがき カタログ（ひらくと ノートの 紙） */
.ex-catalog {
  margin: 16px 0 0;
}
.ex-catalog summary {
  display: inline-block;
  padding: 6px 12px 4px;
  background: #fff7d6;
  color: var(--navy);
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 0 0 2px var(--ink);
}
.ex-catalog summary::-webkit-details-marker {
  display: none;
}
.ex-catalog summary::before {
  content: "▶ ";
  color: var(--red);
}
.ex-catalog[open] summary::before {
  content: "▼ ";
}
.ex-catalog summary:hover {
  background: #ffe680;
}
.ex-memo {
  margin: 10px 0 0;
  padding: 6px 14px 10px 26px;
  background:
    linear-gradient(90deg, transparent 15px, #f2a0a0 15px 17px, transparent 17px),
    repeating-linear-gradient(#fffdf5 0 27px, #cfe3f3 27px 28px);
  box-shadow: 0 0 0 2px #c9bfa8, 4px 4px 0 2px rgba(43, 47, 58, 0.15);
  rotate: -0.6deg;
}
.ex-memo h4 {
  margin: 8px 0 2px;
  color: var(--red);
  font-size: 15px;
  font-weight: normal;
}
.ex-memo .ex-list,
.ex-steps {
  margin: 0;
  padding-left: 1.3em;
  font-size: 15px;
  line-height: 28px;
}
.ex-memo .ex-list li,
.ex-steps li {
  margin: 0;
}
.panel .ex-psst {
  margin: 10px 0 0;
  color: var(--red);
  font-size: 14px;
  line-height: 28px;
}
.panel .ex-sign {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}
.panel .ex-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
/* ショーウィンドウの ピクセ（おすと ワープあなへ） */
.ex-window {
  position: relative;
  align-self: start;
}
.ex-warp {
  position: absolute;
  right: -10px;
  bottom: -18px;
  display: block;
  line-height: 0;
}
.ex-warp canvas {
  position: relative;
  display: block;
}
.ex-warp::after {
  content: "いってみる？";
  position: absolute;
  right: 100%;
  bottom: 70%;
  padding: 3px 8px 2px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 0 0 2px var(--ink);
  pointer-events: none;
}
.ex-warp:hover::after,
.ex-warp:focus-visible::after {
  background: #ffe680;
}
.ex-warp.warping::after {
  content: "いってきまーす！";
}
/* ワープあな（おした ときだけ、1 回 うごく） */
.ex-warp::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 0;
  translate: -50% 40%;
  border-radius: 50%;
  background: radial-gradient(#1a1030 40%, #6b3fd6 60%, #3ee8ff 75%, transparent 76%);
}
.ex-warp.warping::before {
  animation: warp-hole 0.7s steps(7) forwards;
}
.ex-warp.warping canvas {
  animation: warp-dive 0.7s steps(7) forwards;
}
@keyframes warp-hole {
  40% { width: 60px; height: 22px; }
  100% { width: 60px; height: 22px; }
}
@keyframes warp-dive {
  30% { translate: 0 -14px; }
  100% { translate: 0 30px; scale: 0.2; opacity: 0; }
}
.ex-soon {
  background: repeating-linear-gradient(-45deg, #fff 0 12px, #fff7d6 12px 24px);
}
.ex-soon .ex-name {
  color: var(--muted);
}

/* ---------- なかま図鑑 ---------- */
.tribe {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  margin: 28px 0 12px;
}
.tribe span {
  padding: 2px 10px;
  background: var(--navy);
  color: #fff;
}
.tribe small {
  color: var(--muted);
  font-size: 14px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.card {
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: auto 1fr;
  gap: 2px 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--ink);
  scroll-margin-top: 16px;
}
.card:focus {
  outline: none;
}
.card canvas.deep {
  padding: 6px;
  background: #2a2033;
}
.card canvas {
  grid-row: 1 / 3;
  justify-self: center;
  align-self: start;
  max-width: 60px;
  height: auto;
  padding: 6px 0;
}
.card-wide {
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto;
  background: linear-gradient(90deg, #eaf6ff, #fff 40%);
}
.card-wide canvas.portrait {
  grid-row: auto;
  max-width: none;
  width: 80px;
  padding: 0;
}
.c-name {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.4;
}
.c-name small {
  display: block;
  color: var(--red);
  font-size: 13px;
}
.c-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.card dl {
  margin: 6px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
}
.card dt {
  color: var(--navy);
  font-size: 14px;
}
.card dd {
  margin: 0;
}
@media (max-width: 480px) {
  .card dl {
    grid-template-columns: 1fr;
  }
  .card dd {
    margin-bottom: 6px;
  }
}

/* 図鑑から 会いに いく */
.meet {
  grid-column: 2;
  justify-self: start;
  margin-top: 8px;
  padding: 4px 10px 3px;
  border: 0;
  background: #eaf6ff;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--navy);
}
.meet:hover {
  background: #d4ecff;
}
.card-wide .meet {
  margin-top: 4px;
}

/* パネルの ふちから のぞく キャラクター */
.panel {
  position: relative;
}
.peek {
  position: absolute;
  pointer-events: none;
}
.peek-pikuse {
  right: 20px;
  top: -40px;
  clip-path: inset(0 0 25% 0);
}
.peek-cat {
  right: 24px;
  top: -22px;
}
.peek-sparrow {
  right: 28px;
  top: -18px;
}

/* いちばん 下：最深部の 石の プレート */
footer {
  width: fit-content;
  max-width: var(--w);
  margin: 0 auto;
  padding: 12px 20px;
  background: #2a2033;
  color: #efe6d6;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 0 0 var(--px) #4c3f5a, 0 0 0 calc(var(--px) + 2px) #140f1a;
}
body::after {
  content: "";
  display: block;
  height: 40px;
}
footer p {
  margin: 4px 0;
}
footer a {
  color: #ffe680;
}

/* 動きを へらす せってい */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
