/* ============================================================
   WILD∞GROWTH:R Wiki Skin
   PukiWiki Minimal（koichi-inoue/PukiWiki_Minimal）専用調整版
   （キャラクターシート／管理画面／エントランスページと同じ配色・書体）

   PukiWiki Minimal は skin/pukiwiki.skin.php を独自のセマンティックタグで
   再構成しており（<header> <nav> <article> <main> <note> <attach>
   <lastmodified> <related> <footer>、編集モードは <editMode>）、
   ページ内部（表・見出し・編集フォームなど）は本体の pukiwiki.css が
   そのまま出力する標準的なマークアップを使っています。

   このCSSは additional.css と同様に、既存の pukiwiki.css の「後」に
   読み込む追加CSSとして使う想定です。
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Spectral:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #14171C;
  --ink-void: #0A0B0E;
  --panel: #171A21;
  --panel-raised: #1B1F27;
  --bronze: #B98D46;
  --bronze-bright: #E8C989;
  --text: #ECE7DB;
  --text-dim: #9BA0AC;
  --text-faint: #5A6070;
  --line: #2A2F38;
}

/* ライトテーマ。#themeToggleボタンで<html>のdata-theme属性を切り替える
   (skin/js/theme-toggle.js)。変数の集合はダークテーマと完全に同じなので、
   このブロック以外の既存CSSは一切変更不要。 */
:root[data-theme="light"] {
  --ink: #F5F0E5;
  --ink-void: #FFFFFF;
  --panel: #FAF6EC;
  --panel-raised: #FFFFFF;
  --bronze: #A6763A;
  --bronze-bright: #8B5A22;
  --text: #2B2419;
  --text-dim: #6E6455;
  --text-faint: #A39880;
  --line: #E2D9C7;
}

/* PC幅(768px超)では#searchBox formがright:3rem〜約16remの帯を占有しているため、
   そのさらに左側(right:18rem)に配置。768px以下は検索欄自体が下の行に移るレイアウトに
   変わるので、ハンバーガーメニューの左隣(right:5.5rem)に戻す。 */
#themeToggle {
  position: fixed;
  top: 1.25rem;
  right: 18rem;
  z-index: 1000;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--bronze-bright);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
#themeToggle:hover {
  color: #F0D9A8;
  border-color: var(--bronze-bright);
}
@media only screen and (max-width: 768px) {
  #themeToggle {
    top: 1rem;
    right: 5.5rem;
  }
}
/* additional.cssの#menuButton a{color:white}はダークテーマのヘッダー背景を前提に固定色
   にしているため、ライトテーマだと白背景に白アイコンで見えなくなる。
   ライト時だけアイコン色を上書きする。 */
:root[data-theme="light"] #menuButton a {
  color: var(--text);
}

/* ---------- 基本 ---------- */

html, body {
  background: var(--ink) !important;
  color: var(--text) !important;
  font-family: 'Inter', 'Hiragino Kaku Gothic ProN', 'Meiryo', system-ui, sans-serif !important;
  line-height: 1.75;
}

a {
  color: var(--bronze-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 141, 70, 0.35);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover {
  color: #F0D9A8;
  border-bottom-color: var(--bronze-bright);
}

/* ---------- 骨組み（PukiWiki Minimal 独自タグ） ---------- */

header {
  background: var(--ink-void) !important;
  border-bottom: 1px solid var(--line);
  padding: 16px 20px !important;
}
header a { color: var(--text-dim); border-bottom: none; }
header * { color: var(--text) !important; }

#portalLink {
  position: fixed;
  top: 0.3rem;
  right: 1rem;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: none !important;
  opacity: 0.75;
}
#portalLink:hover { opacity: 1; }

@media only screen and (max-width: 768px) {
  #portalLink { display: none; }
}

readMode, editMode {
  display: block;
  background: var(--ink) !important;
}

nav {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text-dim) !important;
  border-radius: 6px;
  padding: 14px 16px !important;
}
nav h2, nav h3 {
  font-size: 13px;
  color: var(--bronze) !important;
  border-bottom: none !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
nav a { border-bottom-color: transparent; }
nav a:hover { border-bottom-color: var(--bronze-bright); }

article, main {
  background: var(--ink) !important;
  color: var(--text) !important;
}

note, attach {
  display: block;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px;
  padding: 14px 16px !important;
  margin: 1.2em 0;
  color: var(--text-dim) !important;
}
note::before { content: '注記'; display: block; font-size: 11px; color: var(--bronze); letter-spacing: 0.1em; margin-bottom: 6px; }
attach::before { content: '添付ファイル'; display: block; font-size: 11px; color: var(--bronze); letter-spacing: 0.1em; margin-bottom: 6px; }

lastmodified, related {
  display: block;
  color: var(--text-faint) !important;
  font-size: 12px;
  margin-top: 1.5em;
  padding-top: 0.8em;
  border-top: 1px dotted var(--line);
}
lastmodified a, related a { color: var(--text-faint); }

footer {
  background: var(--ink-void) !important;
  border-top: 1px solid var(--line);
  color: var(--text-faint) !important;
  font-size: 11px;
  padding: 20px !important;
}
footer a { color: var(--text-faint); border-bottom: none; }
footer * { color: var(--text-faint) !important; }

/* PukiWiki Minimal は #readMode を display:flex で nav / article の
   2カラムにしている（additional.css 側の指定）。背景色だけ合わせておく */
#readMode { background: var(--ink) !important; }


/* ---------- 見出し ---------- */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Spectral', serif !important;
  font-weight: 600;
  color: var(--text) !important;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 28px;
  padding-bottom: 0.5em;
  margin-bottom: 0.8em;
  border-bottom: 1px solid var(--line);
  position: relative;
}
h1::before {
  content: '◆';
  color: var(--bronze);
  font-size: 0.55em;
  margin-right: 0.5em;
  vertical-align: middle;
}

h2 {
  font-size: 22px;
  margin-top: 1.6em;
  padding-bottom: 0.35em;
  border-bottom: 1px dotted var(--line);
}

h3 { font-size: 18px; color: var(--bronze-bright) !important; }
h4 { font-size: 16px; color: var(--text-dim) !important; }

/* 見出し横の [edit] 等の小さいリンク */
h1 a.edit_link, h2 a.edit_link, h3 a.edit_link,
h1 .small, h2 .small, h3 .small {
  font-family: 'Inter', sans-serif !important;
  font-size: 11px;
  color: var(--text-faint) !important;
  border-bottom: none;
}

/* ---------- 本文まわりのブロック要素 ---------- */

pre, .source {
  background: var(--ink-void) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 4px;
  padding: 12px 14px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  overflow-x: auto;
}

code, tt {
  background: rgba(185, 141, 70, 0.12);
  color: var(--bronze-bright);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

blockquote {
  border-left: 3px solid var(--bronze);
  margin-left: 0;
  padding: 4px 16px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.02);
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

/* ---------- 表 ---------- */

table, .style_table, table.pgid_table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  background: var(--panel) !important;
}
table th, .style_table th {
  background: var(--panel-raised) !important;
  color: var(--bronze-bright) !important;
  border: 1px solid var(--line) !important;
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
}
table td, .style_table td {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  padding: 8px 12px;
  color: var(--text) !important;
}
/* PukiWiki本体側が縞模様の背景色を付けてくることがあるため、
   行・セルどちらにも !important で上書きしておく */
table tr, .style_table tr {
  background: var(--panel) !important;
}
table tr:nth-child(even),
table tr:nth-child(even) td,
.style_table tr:nth-child(even),
.style_table tr:nth-child(even) td {
  background: var(--panel-raised) !important;
}

/* 固定px幅の列指定(LEFT:240 等)がスマホ幅と衝突して列が不釣り合いに
   圧縮される問題への対処。table自体をwidth:100%で収めようとする代わりに、
   収まらない分はテーブルごと横スクロールさせる。 */
@media only screen and (max-width: 768px) {
  table, .style_table, table.pgid_table {
    display: block;
    overflow-x: auto;
  }
  table th, table td, .style_table th, .style_table td,
  table.pgid_table th, table.pgid_table td {
    white-space: nowrap;
  }
  /* px幅を明示指定している列は、nowrap環境でもその幅を最低保証する */
  table td[style*="width:80px"], table th[style*="width:80px"], .style_table td[style*="width:80px"], .style_table th[style*="width:80px"] { min-width: 80px; }
  table td[style*="width:100px"], table th[style*="width:100px"], .style_table td[style*="width:100px"], .style_table th[style*="width:100px"] { min-width: 100px; }
  table td[style*="width:60px"], table th[style*="width:60px"], .style_table td[style*="width:60px"], .style_table th[style*="width:60px"] { min-width: 60px; }
  table td[style*="width:540px"], table th[style*="width:540px"], .style_table td[style*="width:540px"], .style_table th[style*="width:540px"] { min-width: 540px; }
  table td[style*="width:90px"], table th[style*="width:90px"], .style_table td[style*="width:90px"], .style_table th[style*="width:90px"] { min-width: 90px; }
  table td[style*="width:98px"], table th[style*="width:98px"], .style_table td[style*="width:98px"], .style_table th[style*="width:98px"] { min-width: 98px; }
  table td[style*="width:300px"], table th[style*="width:300px"], .style_table td[style*="width:300px"], .style_table th[style*="width:300px"] { min-width: 300px; }
  table td[style*="width:50px"], table th[style*="width:50px"], .style_table td[style*="width:50px"], .style_table th[style*="width:50px"] { min-width: 50px; }
  table td[style*="width:350px"], table th[style*="width:350px"], .style_table td[style*="width:350px"], .style_table th[style*="width:350px"] { min-width: 350px; }
  table td[style*="width:240px"], table th[style*="width:240px"], .style_table td[style*="width:240px"], .style_table th[style*="width:240px"] { min-width: 240px; }
  table td[style*="width:541px"], table th[style*="width:541px"], .style_table td[style*="width:541px"], .style_table th[style*="width:541px"] { min-width: 541px; }
  table td[style*="width:125px"], table th[style*="width:125px"], .style_table td[style*="width:125px"], .style_table th[style*="width:125px"] { min-width: 125px; }

}

/* ---------- リスト ---------- */

ul, ol { padding-left: 1.6em; }
ul li::marker, ol li::marker { color: var(--bronze); }

/* ---------- 編集フォーム／入力系 ---------- */

input[type="text"], input[type="password"], input[type="submit"],
input[type="button"], textarea, select {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 4px;
  padding: 6px 10px;
  font-family: 'Inter', sans-serif !important;
  box-sizing: border-box;
  max-width: 100%;
}
textarea {
  font-family: 'SFMono-Regular', Consolas, monospace !important;
}
input[type="submit"], input[type="button"], button {
  background: var(--bronze) !important;
  color: var(--ink) !important;
  border: none !important;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
input[type="submit"]:hover, input[type="button"]:hover, button:hover {
  background: var(--bronze-bright) !important;
}

/* ---------- 添付ファイル・コメント・カレンダー等の代表的なプラグイン領域 ---------- */

.attach_tag, .comment, .calendar, .calendar2, #recent_comment,
.plugin_attach, .plugin_calendar, .plugin_comment {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  color: var(--text-dim) !important;
  border-radius: 6px;
}
.calendar td, .calendar2 td { border-color: var(--line) !important; }
.calendar a, .calendar2 a { color: var(--bronze-bright); }

/* ---------- 存在しないページへのリンク（WikiName等でpukiwiki.cssが
   span.noexists{background-color:#FFFACC}を出す。ライトテーマ前提の淡い黄色背景に、
   このテーマの明るい本文色(--text)がそのまま乗って白地に白文字同然になり読めなく
   なっていたのを修正） ---------- */
span.noexists {
  background-color: transparent !important;
  border-bottom: 1px dashed var(--text-faint);
}
span.noexists a {
  color: var(--text-faint) !important;
  border-bottom: none !important;
}
span.noexists a:hover {
  color: var(--bronze-bright) !important;
}

/* ---------- 紋章カードのJSON出力ボタン（crestjsonプラグイン） ---------- */
.crestjson-button-wrap {
  margin: 0.8em 0;
}
a.crestjson-button {
  display: inline-block;
  background: var(--bronze) !important;
  color: var(--ink) !important;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 4px;
  border-bottom: none !important;
  transition: background 0.15s ease;
}
a.crestjson-button:hover {
  background: var(--bronze-bright) !important;
  color: var(--ink) !important;
}

/* ---------- 選択範囲のハイライト（好みで） ---------- */

::selection {
  background: rgba(185, 141, 70, 0.35);
  color: var(--text);
}
