/*!
 * site.css - takahashimisaki.jp 共通スタイル（全ページ・ゲーム共通）
 * デザインルール: dev/DESIGN.md ／ 決定の記録: dev/REDESIGN.md
 *
 * Kathamo v3.0.0 (http://kathamo.github.com) を土台に、normalize と基本の書式だけを残して再構成。
 * グリッドは Kathamo の12カラムを使わず、7カラムのものを書いている。
 * Kathamo: Copyright 2014-2015 Debashis Barman, MIT License
 * normalize.css v3.0.2 | MIT License | git.io/normalize
 */

/* ==========================================================================
   0. トークン（色・寸法はここ以外で直接指定しない）
   ========================================================================== */
:root {
  /* 無彩色 */
  --ink: #111;          /* 本文・見出し・枠線 */
  --ink-sub: #666;      /* 日付・項目名・補足 */
  --line-img: #d0d0d0;  /* 画像の細い枠・奥付の区切り・一行企画の区切り */
  --line: #d9d9d9;      /* ツール部品の弱い線 */
  --bg: #fff;
  --surface: #f5f5f5;   /* ツール・ゲームのルール欄の背景 */
  --danger: #b84139;    /* エラー表示だけ（= PZ.Theme.error） */

  /* 1件ごとの色（7色。サイト全体で追加した順に回して割り当て、固定する） */
  --c1: #a45a4e; --c2: #8f6b20; --c3: #5a7e3e; --c4: #008478;
  --c5: #297aa4; --c6: #6e68a9; --c7: #975985;
  --c: var(--ink);      /* その1件の色（各件の style="--c: var(--cN)" で渡す） */
  --page: var(--ink);   /* 1ページで1件のページは、その1件の色（body の style で渡す） */

  /* 線 */
  --frame: 3px;         /* 太い枠 */
  --frame-hover: 1px;   /* マウスを重ねたときに outline で足す太さ */

  /* 寸法・グリッド（最大幅1024px・7カラム、間隔12px） */
  --content-max: 1024px;
  --gutter: 16px;
  --gap: 12px;
  /* 本文の幅：7カラムのうち5カラム分（main の幅を基準に計算）。860px以下は全幅 */
  --measure: calc((100cqw - var(--gap) * 6) * 5 / 7 + var(--gap) * 4);
}

/* ==========================================================================
   1. リセット（normalize.css から必要分のみ）
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
}
article, aside, details, figcaption, figure, footer, header, main, nav, section, summary {
  display: block;
}
audio, canvas, progress, video {
  display: inline-block;
  vertical-align: baseline;
}
[hidden] {
  display: none;
}
b, strong {
  font-weight: 700;
}
img {
  border: 0;
  max-width: 100%;
  height: auto;
}
button, input, select, textarea {
  margin: 0;
  color: inherit;
  font: inherit;
}
button {
  overflow: visible;
  text-transform: none;
  cursor: pointer;
}
button[disabled] {
  cursor: default;
}

/* ==========================================================================
   2. 基本タイポグラフィ
   ========================================================================== */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans JP", sans-serif;
  font-weight: 400;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 {
  font-family: inherit;
  font-weight: 700;
  color: inherit;
  line-height: 1.35;
}
h1 { margin: 0 0 20px; font-size: 1.15rem; }
h2 { margin: 40px 0 12px; font-size: 1rem; line-height: 1.5; }
h3 { margin: 24px 0 8px; font-size: 1rem; }
h4 { margin: 20px 0 8px; font-size: 1rem; }
p {
  margin: 0 0 1em;
}
small {
  font-size: .8em;
  color: var(--ink-sub);
}
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line-img);
}
ul, ol {
  padding-left: 1.5em;
}
code, kbd, pre {
  font: 400 .85em Menlo, Monaco, Consolas, "Courier New", monospace;
}
.text-center {
  text-align: center;
}
.lead {
  margin: 0 0 24px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   3. フォーム部品（ツール・ゲームで使う）
   ========================================================================== */
button,
*[data-role="button"],
.btn {
  display: inline-block;
  min-width: 6em;
  padding: .35em 1.2em;
  font-size: .95rem;
  line-height: 1.8;
  white-space: nowrap;
  color: var(--ink);
  background: var(--bg);
  border: var(--frame) solid var(--ink);
  text-decoration: none;
  outline: 0 solid transparent;
}
/* マウスを重ねたとき：塗りつぶさず、outline で枠を太く見せる（1件の枠と同じ） */
button:hover,
*[data-role="button"]:hover,
.btn:hover,
button:focus-visible,
.btn:focus-visible {
  outline: var(--frame-hover) solid var(--ink);
  outline-offset: 0;
}
button.primary,
.btn.primary {
  color: var(--bg);
  background: var(--ink);
}
button.primary:hover,
.btn.primary:hover {
  color: var(--bg);
  background: var(--ink);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
input,
textarea,
select {
  max-width: 100%;
  padding: .35em .7em;
  font-size: .95rem;
  border: 1px solid var(--ink-sub);
  border-radius: 0;
  background: var(--bg);
}
select {
  width: 100%;
}
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  accent-color: var(--ink);
}
input[type="range"] {
  width: 100%;
  padding: 0;
  border: 0;
  accent-color: var(--ink);
}
label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
}
.field + .field {
  margin-top: 12px;
}
.field-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: .9rem;
  margin-bottom: 4px;
}
.field-label span:last-child {
  color: var(--ink-sub);
  font-variant-numeric: tabular-nums;
}

/* パネル（囲み） */
.panel {
  background: var(--bg);
  border: var(--frame) solid var(--ink);
}
.panel > .panel-head {
  padding: .5em 1em;
  font-weight: 700;
  border-bottom: 1px solid var(--line-img);
}
.panel > .panel-body {
  padding: 1em;
}
.panel-section {
  padding: 1em;
}
.panel-section + .panel-section {
  border-top: 1px solid var(--line);
}
.panel-section h2 {
  margin: 0 0 .6em;
  font-size: .9rem;
}

/* アラート（エラーだけ状態色を使う） */
.alert {
  padding: .5em 1em;
  border: 1px solid var(--ink);
}
.alert.alert-danger {
  color: var(--danger);
  border-color: var(--danger);
}

/* バッジ */
.badge {
  display: inline-block;
  font-size: .75rem;
  padding: 0 8px;
  border: 1px solid currentColor;
}

/* ==========================================================================
   4. ページの骨組み（ヘッダー・本文・フッター）
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--gutter);
  padding-left: var(--gutter);
}

/* ヘッダー：下線は、個別ページではその1件の色（--page） */
.site-header {
  border-bottom: var(--frame) solid var(--page);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 60px;
}
.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .9rem;
}
.site-nav a {
  text-decoration: none;
  white-space: nowrap;
  border-bottom: var(--frame) solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-bottom-color: var(--ink);
}
.menu-button {
  display: none;
}

/* 本文：本文の幅（--measure）の計算の基準にする */
main {
  padding: 32px 0 48px;
  container-type: inline-size;
}
/* 本文だけのページ（文章・企画・自己紹介・コラボ・寄稿など）は、題名・戻るリンク・本文・奥付を
   中央の5カラム分の列にそろえる（左右に1カラムずつ空く）。一覧（格子・行・入口）は全幅のまま。
   860px 以下では --measure が 100% なので、左の余白は 0 になる */
main.narrow > * {
  max-width: var(--measure);
  margin-left: calc((100cqw - var(--measure)) / 2);
}

/* 一覧へ戻るリンク */
.back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: .85rem;
}
.back-bottom {
  display: inline-block;
  margin-top: 24px;
  font-size: .85rem;
}

/* フッター */
.site-footer {
  padding: 24px 0 32px;
  text-align: center;
  font-size: .9rem;
  line-height: 1.6;
}
.site-footer p {
  margin: 0;
}
.rule-we {
  letter-spacing: .05em;
}

/* ==========================================================================
   5. 部品（オブジェクトの種類ごと）
   ========================================================================== */

/* 5.1 入口（トップ。正方形のイラスト＋セクション名） */
.entrances {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0 0 48px;
  padding: 0;
  list-style: none;
}
.entrance {
  display: block;
  height: 100%;
  border: var(--frame) solid var(--ink);
  text-decoration: none;
  outline: 0 solid transparent;
}
.entrance svg {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: var(--frame) solid var(--ink);
}
.entrance svg * {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: miter;
  stroke-linecap: square;
}
.entrance svg .paper {
  fill: var(--bg);
}
.entrance-name {
  display: block;
  padding: 6px 8px;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}
.section-label {
  margin: 0 0 12px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-sub);
}

/* 5.2 枠付きの行（トップの新着・文章の一覧） */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}
.rows li + li {
  margin-top: 6px;
}
.rows a {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 3px 10px;
  line-height: 1.5;
  text-decoration: none;
  border: var(--frame) solid var(--ink);
  outline: 0 solid transparent;
}
.rows.news a {
  grid-template-columns: 7em 6em minmax(0, 1fr);
}
.rows .date,
.rows .section {
  color: var(--ink-sub);
  font-size: .85rem;
}
.rows .date {
  font-variant-numeric: tabular-nums;
}

/* 5.3 格子（服・ゲーム・ZINE・DTM・動画の一覧。トップの入口と同じ列数） */
.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.item {
  display: block;
  height: 100%;
  text-decoration: none;
  border: var(--frame) solid var(--ink);
  outline: 0 solid transparent;
}
.item .shot {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--bg);
  border-bottom: var(--frame) solid var(--ink);
}
.item .noshot {
  display: grid;
  place-items: center;
  color: var(--ink-sub);
  font-size: .8rem;
}
.videos .shot {
  aspect-ratio: 16 / 9;
  object-fit: cover;   /* YouTube のサムネイルは上下に黒い帯が入った4:3なので、16:9で切り抜く */
}
.cap {
  display: block;
  padding: 6px 8px;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.5;
}
.cap .no {
  margin-right: .5em;
  color: var(--ink-sub);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.cap .desc,
.cap .ch {
  display: block;
  color: var(--ink-sub);
  font-weight: 400;
  font-size: .8rem;
}

/* 5.4 一度開いた件・マウスを重ねたとき：その1件の色が枠に出る。
   太さは outline で足すので、周りのレイアウトはずれない */
.rows a.seen,
.item.seen {
  border-color: var(--c);
}
.item.seen .shot {
  border-bottom-color: var(--c);
}
.entrance:hover, .entrance:focus-visible,
.rows a:hover, .rows a:focus-visible,
.item:hover, .item:focus-visible {
  border-color: var(--c);
  outline: var(--frame-hover) solid var(--c);
}
.entrance:hover svg, .entrance:focus-visible svg,
.item:hover .shot, .item:focus-visible .shot {
  border-bottom-color: var(--c);
}

/* 5.5 奥付（項目と値） */
.colophon {
  margin: 0 0 24px;
  max-width: var(--measure);
  border: var(--frame) solid var(--page);
}
.colophon div {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 12px;
  padding: 4px 10px;
}
.colophon div + div {
  border-top: 1px solid var(--line-img);
}
.colophon dt {
  color: var(--ink-sub);
  font-size: .85rem;
}
.colophon dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.text .colophon {
  margin: 40px 0 0;   /* 文章の奥付は本文の後ろ */
}
/* 名前を枠の見出しにして、値を細い線で区切る形（自己紹介） */
.colophon.named dt {
  padding: 4px 10px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line-img);
}
.colophon.named dd {
  padding: 4px 10px;
}
.colophon.named dd + dd {
  border-top: 1px solid var(--line-img);
}
.contact-address {
  margin-top: 32px;
}

/* 5.6 長文 */
.text {
  max-width: var(--measure);
}
.text h1 {
  margin: 0 0 24px;
  font-size: 1.15rem;
  line-height: 1.5;
}
.text ul {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.text li + li {
  margin-top: 4px;
}

/* 5.7 一行の並び（一行企画。記号を付けず、細い灰色の線で区切る） */
.lines {
  max-width: var(--measure);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-img);
}
.lines li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line-img);
}

/* 5.8 画像＋奥付（服・ZINE・DTM の個別ページ。画像4カラム・奥付3カラム） */
.work {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.work > :first-child {
  grid-column: span 4;
}
.work > :last-child {
  grid-column: span 3;
}
.work-image {
  margin: 0;
  border: var(--frame) solid var(--page);
}
.work-image img,
.work-image .noshot {
  display: block;
  width: 100%;
  height: auto;
}
.work-image .noshot {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1.414;
  color: var(--ink-sub);
  font-size: .9rem;
}
.work h1 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  line-height: 1.5;
}
.work .colophon {
  max-width: none;
}

/* 5.9 再生部品（DTM。太い枠のボタン＋経過時間／長さ＋細い線のシークバー。角丸なし） */
.player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 20px;
}
.player button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 12px;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: var(--frame) solid var(--page);
  border-radius: 0;
  outline: 0 solid transparent;
}
.player button:hover,
.player button:focus-visible {
  color: var(--ink);
  background: var(--bg);
  outline: var(--frame-hover) solid var(--page);
}
.player .icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--ink);
}
.player .icon.play {
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.player .time {
  font-size: .85rem;
  color: var(--ink-sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.player input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.player input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
.player input[type="range"]::-moz-range-track { height: 1px; background: var(--ink); }
.player input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; margin-top: -5px; background: var(--ink); border: 0; border-radius: 0; }
.player input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; background: var(--ink); border: 0; border-radius: 0; }
.player input[type="range"]:focus-visible { outline: 1px solid var(--page); outline-offset: 2px; }

/* ==========================================================================
   6. ツール・ゲーム（枠の決まりにそろえた：角丸なし、ボタン・パネル・盤の囲みは太い枠3px）
   ========================================================================== */

/* 6.1 ツール（キャンバス＋操作パネル。狭い画面では縦積み） */
.tool {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}
.tool-stage {
  flex: 1 1 420px;
  min-width: 0;
}
.tool-panel {
  flex: 0 1 300px;
  width: 100%;
}

/* 6.2 ツールの入出力（パスワード生成など） */
.field-row + .field-row {
  margin-top: 12px;
}
.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.result-box {
  padding: .5em .8em;
  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 1.1rem;
  word-break: break-all;
  background: var(--surface);
}
.meter {
  height: 6px;
  background: var(--line);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  width: 0;
}
.copied-msg {
  margin-left: 8px;
  font-size: .85rem;
  color: var(--ink);
  opacity: 0;
  transition: opacity .2s ease;
}
.copied-msg.show {
  opacity: 1;
}
.stack > * + * {
  margin-top: 20px;
}

/* 6.3 パズルゲーム・キャンバス */
.game-rules {
  border: 1px solid var(--line-img);
  padding: 16px 20px;
  margin-bottom: 20px;
  font-size: .92rem;
  line-height: 1.7;
}
.game-rules p:last-child {
  margin-bottom: 0;
}
.game-stage {
  border: var(--frame) solid var(--ink);
  padding: 20px;
  text-align: center;
}
#canvas-holder {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: .85rem;
  color: var(--ink-sub);
}

/* キャンバスは画面幅に合わせて縮小（p5.js はインラインで px 指定するため !important） */
canvas {
  max-width: 100% !important;
  height: auto !important;
}

/* ==========================================================================
   7. 画面幅による切り替え（860px：入口が4列／600px：スマートフォン）
   ========================================================================== */
@media (max-width: 860px) {
  :root {
    --measure: 100%;
  }
  .entrances,
  .grid,
  .work {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .work > :first-child,
  .work > :last-child {
    grid-column: span 2;
  }
}
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }
  /* ナビはメニューボタンで開く */
  .menu-button {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    background: none;
    border: var(--frame) solid var(--ink);
    border-radius: 0;
  }
  .menu-button:hover {
    background: none;
  }
  .menu-button span {
    display: block;
    height: 3px;
    background: var(--ink);
  }
  .site-nav {
    display: none;
    width: 100%;
  }
  .site-nav.is-open {
    display: block;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding-bottom: 12px;
    font-size: 1rem;
  }
  .site-nav li + li {
    border-top: 1px solid var(--line-img);
  }
  .site-nav a {
    display: block;
    padding: 10px 0;
    border-bottom: 0;
  }
  .entrances,
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .entrance-name,
  .cap {
    padding: 4px 6px;
    font-size: .8rem;
  }
  .rows a {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .rows.news a {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "date section" "title title";
    gap: 0 12px;
  }
  .rows.news .date { grid-area: date; }
  .rows.news .section { grid-area: section; }
  .rows.news .title { grid-area: title; }
  .work {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .work > :first-child,
  .work > :last-child {
    grid-column: auto;
  }
  .game-rules,
  .game-stage {
    padding: 12px;
  }
}
