/* 全ページ共通のスタイル(index / tools / portfolio / oc)
   ナビ・余白・ヘッダー(バッジ/見出し/リード文)・配色はここだけで管理します。
   ページ固有のスタイルは各HTMLの <style> にあります。右下のマスコットのスタイルも、このファイルの最後にあります。 */

:root {
  --bg: #faf6ee;
  --ink: #201c16;
  --ink-dim: #6b6559;
  --ink-mute: #797265; /* 白背景で 4.8:1(以前の #9a9284 は 3.1:1 で、小さい文字には薄すぎた) */
  --card-border: #201c16;
  --yellow: #ffd23f;
  --teal: #37b7a4;
  --pink: #ff6b7a;
  --blue: #5b8def;
  --purple: #b98aef;
  --orange: #ffa94d;
  --green: #8bc76b;
  --sky: #4cc9f0;
  --magenta: #ff65a3;
}

* { box-sizing: border-box; }

/* Android の一部アプリ内ブラウザ(X/Twitterなど)は、ページの見た目にかかわらず
   文字を自動で拡大する「文字サイズの自動調整」を行うことがある。
   これが原因で、ナビや見出しの文字だけ大きくなり、はみ出したり、レイアウトが
   崩れて見えたりする(横に伸びて、左側が画面の外に隠れる、など)。
   この指定で、その自動調整を止め、書いたとおりのサイズで表示させる */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* X(旧Twitter)アプリ内の「カードプレビュー」ブラウザなど、シート状の埋め込みブラウザは、
     開閉時にフレームの幅だけをリサイズしてレイアウトを再計算しないことがある。
     その結果、以前の(通常は画面いっぱいの)幅で描画された内容が、新しい狭いフレームで
     そのまま切り取られ、左側が見切れて表示されることがある。
     html/body の幅を明示的に100%に固定し、横方向にはみ出た分は隠す(スクロールさせない)
     ことで、はみ出し自体をできるだけ起こさないようにする */
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  display: flex;
  justify-content: center;
  padding: 32px 20px 60px;
  animation: fadein 0.15s ease;
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

main { width: 100%; max-width: 560px; }

/* --- アイコン(Material Symbols) ---
   フォントのCSSは、表示を止めないようにあとから読み込むので、アイコンの基本の指定はこちらに持たせる。
   フォントが届くまでは、文字名(close など)で幅が広がらないよう幅を1emに固定し、さらに隠しておく
   (各ページの head の小さなスクリプトが、フォントが届いたら html に icons-ready を付ける) */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  width: 1em;
  overflow: hidden;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.js .material-symbols-outlined { visibility: hidden; }
.js.icons-ready .material-symbols-outlined { visibility: visible; }

/* --- ページ移動ナビ ---
   ボタン(ピル型)は「絞り込み・切り替え」専用にしたいので、
   ナビは枠なしのテキストタブにして、今いるページだけ黄色のマーカーを引く */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 22px;
  margin-bottom: 28px;
}

.nav-tabs a {
  position: relative;
  z-index: 0; /* マーカー(::after)を文字の後ろに置くための重なり順の基点 */
  padding: 6px 0;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-dim);
  transition: color 0.12s ease;
}

.nav-tabs a:hover { color: var(--ink); }

.nav-tabs a.active { color: var(--ink); }

.nav-tabs a.active::after {
  content: "";
  position: absolute;
  left: -5px;
  right: -5px;
  bottom: 5px;
  height: 9px;
  background: var(--yellow);
  border-radius: 3px;
  transform: rotate(-1.2deg);
  z-index: -1;
}

.nav-tabs a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- ページ見出し(バッジ + 見出し + リード文)。index は見出しだけ自前で上書き --- */
.badge {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

h1 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  line-height: 1.25;
}

.lede {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.8;
  margin: 0;
}

@media (max-width: 480px) {
  body { padding: 24px 14px 40px; }
  .nav-tabs { gap: 2px 18px; }
  .nav-tabs a { font-size: 13px; }
  h1 { font-size: 24px; }
  .badge { font-size: 10px; }
}

/* ==========================================================
   右下の追従SDイラスト(全ページ共通)
   ここを直せば index / tools / portfolio / oc / 404 すべてに反映されます。
   キャラ連動などページ固有のロジックはJS側(mascot.js、各ページのscript)にあります。
   ========================================================== */

#mascot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 100px;
  height: 100px;
  z-index: 50;
  cursor: pointer;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

#mascot.mascot-hide {
  transform: translateY(140%) rotate(var(--mascot-tilt, 0deg));
  opacity: 0;
  pointer-events: none;
}

#mascot .mascot-inner {
  width: 100%;
  height: 100%;
  /* ランダムな傾き(JSで --mascot-tilt を設定)+ ぽよぽよアニメーション */
  transform: rotate(var(--mascot-tilt, 0deg));
  animation: poyo 4.5s ease-in-out infinite;
}

@keyframes poyo {
  0%, 78% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1, 1); }
  85% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1.08, 0.9); }
  90% { transform: rotate(var(--mascot-tilt, 0deg)) scale(0.94, 1.08); }
  95% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1.02, 0.98); }
  100% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1, 1); }
}

/* タップ時のぽよん(mascot.js が .mascot-tap を付け外しする) */
#mascot .mascot-inner.mascot-tap {
  animation: poyo-tap 0.45s ease-out 1;
}

@keyframes poyo-tap {
  0% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1, 1); }
  20% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1.18, 0.78); }
  45% { transform: rotate(var(--mascot-tilt, 0deg)) scale(0.92, 1.14); }
  70% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1.04, 0.97); }
  100% { transform: rotate(var(--mascot-tilt, 0deg)) scale(1, 1); }
}

#mascot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter:
    drop-shadow(2px 4px 4px rgba(32, 28, 22, 0.35));
}

#mascot .mascot-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2.5px dashed var(--card-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mascot .mascot-placeholder .material-symbols-outlined {
  font-size: 26px;
  color: var(--ink-dim);
}

@media (max-width: 480px) {
  #mascot { width: 68px; height: 68px; right: 12px; bottom: 12px; }
}
