/* スクロールデザイン図鑑 共通CSS（全32デモ＋図鑑サイトで共有）
   仕様書: docs/デザイン仕様書.md が正。数値は全て4/8の倍数。
   使い方: <link rel="stylesheet" href="../_common/common.css"> */

:root {
  /* ベース（無彩色寄り） */
  --bg-page: #F7F5F1;
  --bg-card: #FFFFFF;
  --bg-sunk: #F0EEE9;
  --border: #E3DFD8;
  --text-main: #2B2B2B;
  --text-sub: #6B6B6B;
  /* メイン＝水色（デモの「面」の色） */
  --main-light: #DCEEF2;
  --main-base: #6FAFC9;
  --main-dark: #2E6F8E;
  --main-deep: #1F4F66;
  /* アクセント＝テラコッタ（「いま動いている主役」と「押せる物」だけに使う） */
  --accent-light: #F3DED4;
  --accent-base: #D98E73;
  --accent-dark: #A8502F;
  --accent-deep: #7D3A22;
  /* 暗背景デモ用（WebGL等。無彩色の暗トーン） */
  --dark-bg: #1A1D24;
  --dark-bg-2: #2B3140;
  --on-dark: #F7F5F1;

  /* 余白（8pxグリッド） */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px; --s12: 96px;
  --r-sm: 8px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;

  /* 文字サイズ（5段まで。13はラベル専用、72は大見出しデモ専用） */
  --fs-label: 13px; --fs-body: 16px; --fs-title: 24px; --fs-head: 40px; --fs-display: 72px;

  /* 1ファミリー。iPhone=Hiragino Sans／Windows=Yu Gothic UI。Webフォントは同梱しない */
  --font: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

/* 暗背景デモは <html data-theme="dark"> を付ける */
:root[data-theme="dark"] {
  --bg-page: var(--dark-bg);
  --bg-card: var(--dark-bg-2);
  --bg-sunk: #12141A;
  --border: #3A4152;
  --text-main: var(--on-dark);
  --text-sub: #B8BDC9;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.7;
  /* 日本語の泣き別れ対策。keep-allは日本語に効かないので使わない。
     意味の区切りは .nb（nowrap）で保護する */
  line-break: strict;
  overflow-wrap: break-word;
  word-break: auto-phrase;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; line-height: 1.3; }
.nb { white-space: nowrap; }
img, svg, canvas, video { display: block; max-width: 100%; }

/* 文字の役割（反復。デモ内の見出し・本文はこの4つだけ使う） */
.t-display { font-size: var(--fs-display); line-height: 1.1; font-weight: 700; }
.t-head    { font-size: var(--fs-head);    line-height: 1.3; font-weight: 700; }
.t-title   { font-size: var(--fs-title);   line-height: 1.4; font-weight: 700; }
.t-body    { font-size: var(--fs-body);    line-height: 1.7; font-weight: 400; }
.t-sub     { color: var(--text-sub); }

/* 画面（1画面ぶんのセクション）。縦方向は100svhで揃え、端は16px確保 */
.screen {
  min-height: 100svh;
  padding: var(--s6) var(--s2);
  display: flex; flex-direction: column; justify-content: center;
}
.screen--center { align-items: center; text-align: center; }
.wrap { width: 100%; max-width: 960px; margin-inline: auto; }

/* ---- デモ用の「素材」: 外部画像は使わない。グラデーション＋番号＋短い見出しで作る ---- */
.ph {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  aspect-ratio: 4 / 5;
  padding: var(--s3);
  border-radius: var(--r-lg);
  overflow: hidden;
  color: var(--text-main);
}
.ph--wide { aspect-ratio: 16 / 10; }
.ph--tall { aspect-ratio: 9 / 16; }
.ph--square { aspect-ratio: 1 / 1; }
.ph__no  { font-size: var(--fs-display); line-height: 1; font-weight: 700; }
.ph__cap { font-size: var(--fs-body); line-height: 1.6; font-weight: 700; }
.ph-a { background: linear-gradient(135deg, var(--main-light), var(--main-base)); }
.ph-b { background: linear-gradient(135deg, var(--accent-light), var(--accent-base)); }
.ph-c { background: linear-gradient(135deg, #FFFFFF, #E3DFD8); }
.ph-d { background: linear-gradient(135deg, var(--main-dark), var(--main-deep)); color: #FFFFFF; }
.ph-e { background: linear-gradient(135deg, var(--accent-dark), var(--accent-deep)); color: #FFFFFF; }
.ph-f { background: linear-gradient(135deg, var(--dark-bg-2), var(--dark-bg)); color: var(--on-dark); }

/* 汎用カード（文字が主役のデモ用） */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s3);
}

/* ---- 番号・名前ラベル（common.js が body の data-no / data-name から自動で入れる） ---- */
.demo-label {
  position: fixed;
  top: max(var(--s2), env(safe-area-inset-top));
  left: var(--s2);
  z-index: 1000;
  display: flex; align-items: center; gap: var(--s1);
  height: var(--s4);
  padding: 0 var(--s2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: var(--fs-label); line-height: var(--s4); font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}
.demo-label b { color: #FFFFFF; background: var(--accent-dark); border-radius: var(--r-pill); padding: 0 var(--s1); line-height: var(--s3); }
:root[data-theme="dark"] .demo-label { background: rgba(26, 29, 36, 0.92); color: var(--on-dark); }

/* スクロールのうながし（録画時は消える） */
.demo-hint {
  position: fixed; bottom: var(--s3); left: 50%; transform: translateX(-50%);
  z-index: 1000;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: var(--fs-label); line-height: var(--s3);
  pointer-events: none;
}
:root[data-theme="dark"] .demo-hint { background: rgba(26, 29, 36, 0.92); }

/* 録画モード（?record=1）: 操作ヒントとカーソルを消す */
html.is-record .demo-hint { display: none; }
html.is-record, html.is-record * { cursor: none !important; }

/* PCで開いたとき: 余白だけ広げる（主役はスマホ縦） */
@media (min-width: 768px) {
  .screen { padding-inline: var(--s6); }
}
