/* SNOWPEAK SOLACE wiki — 見た目。色は :root のトークンで持ち、暗い画面は data-theme / prefers-color-scheme で切り替える */
:root {
  --bg: #f4f6f9;
  --bg-panel: #ffffff;
  --bg-code: #eef1f5;
  --ink: #1d2430;
  --ink-sub: #5b6676;
  --line: #d9dfe7;
  --accent: #2f6fab;
  --accent-ink: #ffffff;
  --note: #2f6fab;
  --tip: #2d8a5a;
  --warn: #c0632a;
  --spoiler: #7a4fa5;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06);
  --radius: 10px;
  --sidebar-w: 236px;
  --toc-w: 200px;
  --font: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: "Consolas", "Menlo", "MPLUS1Code", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a22;
    --bg-panel: #1b232d;
    --bg-code: #232d39;
    --ink: #e4e9f0;
    --ink-sub: #9aa6b5;
    --line: #2d3845;
    --accent: #7db2e8;
    --accent-ink: #0f1620;
    --note: #7db2e8;
    --tip: #6fcf97;
    --warn: #f0a070;
    --spoiler: #c4a2ee;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #141a22;
  --bg-panel: #1b232d;
  --bg-code: #232d39;
  --ink: #e4e9f0;
  --ink-sub: #9aa6b5;
  --line: #2d3845;
  --accent: #7db2e8;
  --accent-ink: #0f1620;
  --note: #7db2e8;
  --tip: #6fcf97;
  --warn: #f0a070;
  --spoiler: #c4a2ee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--bg-code); padding: 0.1em 0.4em; border-radius: 5px; }
pre { background: var(--bg-code); padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
strong { font-weight: 700; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 6px 10px; border-radius: 6px; }
.skip:focus { left: 8px; z-index: 100; }

/* 上の帯 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 16px;
  background: var(--bg-panel); border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-main { font-weight: 800; letter-spacing: 0.08em; font-size: 15px; }
.brand-sub { color: var(--ink-sub); font-size: 13px; }
.menu-btn, .theme-btn {
  background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 8px;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer; flex: none;
}
.menu-btn { display: none; }
.search { position: relative; margin-left: auto; width: min(420px, 50vw); }
.search input {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.search-results {
  position: absolute; top: 42px; left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.search-results a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--bg-code); text-decoration: none; }
.search-results .r-title { font-weight: 700; }
.search-results .r-sec { color: var(--ink-sub); font-size: 12px; margin-left: 6px; }
.search-results .r-snip { color: var(--ink-sub); font-size: 12.5px; line-height: 1.5; }
.search-results .r-snip mark { background: transparent; color: var(--accent); font-weight: 700; }
.search-results .r-empty { padding: 10px 12px; color: var(--ink-sub); font-size: 13px; }

/* 骨組み */
.layout { display: flex; max-width: 1360px; margin: 0 auto; }
.sidebar {
  width: var(--sidebar-w); flex: none;
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  padding: 18px 10px 40px 16px; border-right: 1px solid var(--line);
}
.nav-section { margin-bottom: 16px; }
.nav-title { font-size: 12px; color: var(--ink-sub); letter-spacing: 0.08em; margin: 0 0 4px 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 5px 8px; border-radius: 7px; color: var(--ink); font-size: 14px; }
.sidebar li a:hover { background: var(--bg-code); text-decoration: none; }
.sidebar li.current a { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.content { display: flex; flex: 1; min-width: 0; gap: 24px; padding: 24px 24px 60px; align-items: flex-start; }
.page { flex: 1; min-width: 0; max-width: 820px; }
.crumbs { color: var(--ink-sub); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; }
.page h1 { font-size: 28px; line-height: 1.3; margin: 6px 0 18px; letter-spacing: 0.01em; }
.page h2 { font-size: 20px; margin: 36px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.page h3 { font-size: 16.5px; margin: 26px 0 8px; }
.page h4 { font-size: 15px; margin: 18px 0 6px; color: var(--ink-sub); }
.anchor { margin-left: 8px; color: var(--line); font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; color: var(--accent); }
.page p { margin: 0 0 12px; }
.page ul, .page ol { padding-left: 1.4em; margin: 0 0 12px; }
.page li { margin: 2px 0; }
.page li ul { margin: 2px 0 4px; }
.page blockquote { margin: 0 0 14px; padding: 8px 14px; border-left: 3px solid var(--line); color: var(--ink-sub); }
.page blockquote p:last-child { margin-bottom: 0; }

/* 表 */
.table-wrap { overflow-x: auto; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { background: var(--bg-code); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td small { color: var(--ink-sub); font-size: 12.5px; }
td:first-child { white-space: nowrap; }

/* 呼び出し */
.callout { margin: 0 0 16px; padding: 12px 14px 8px; border-radius: var(--radius); border: 1px solid var(--line); border-left: 4px solid var(--note); background: var(--bg-panel); }
.callout.note { border-left-color: var(--note); }
.callout.tip { border-left-color: var(--tip); }
.callout.warn { border-left-color: var(--warn); }
.callout-title { font-weight: 700; font-size: 13px; letter-spacing: 0.05em; margin-bottom: 4px; }
.callout.note .callout-title { color: var(--note); }
.callout.tip .callout-title { color: var(--tip); }
.callout.warn .callout-title { color: var(--warn); }
details.spoiler { border-left-color: var(--spoiler); }
details.spoiler summary { cursor: pointer; color: var(--spoiler); font-weight: 700; margin-bottom: 8px; }
details.spoiler:not([open]) { padding-bottom: 12px; }
details.spoiler summary::marker { color: var(--spoiler); }
.spoiler-lock p { margin: 0 0 8px; color: var(--ink-sub); font-size: 13.5px; }
.spoiler-form { display: flex; gap: 8px; margin-bottom: 8px; }
.spoiler-form input { flex: 1; max-width: 260px; height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.spoiler-form button { height: 34px; padding: 0 14px; border-radius: 7px; border: 0; background: var(--spoiler); color: #fff; font: inherit; font-size: 14px; cursor: pointer; }
.spoiler-form button:disabled { opacity: 0.6; cursor: default; }
.spoiler-err { color: var(--warn); font-size: 13px; }
details.plain { margin: 0 0 14px; }
details.plain summary { cursor: pointer; font-weight: 700; }

/* 目次 */
.toc { width: var(--toc-w); flex: none; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; font-size: 13px; padding-left: 12px; border-left: 1px solid var(--line); }
.toc-title { color: var(--ink-sub); font-size: 12px; letter-spacing: 0.08em; margin-bottom: 6px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 3px 0; line-height: 1.4; }
.toc li.lv3 { padding-left: 12px; font-size: 12.5px; }
.toc a { color: var(--ink-sub); }
.toc a.active, .toc a:hover { color: var(--accent); }

/* 前後 */
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.pn { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-panel); font-size: 14px; }
.pn:hover { text-decoration: none; border-color: var(--accent); }

/* 下の帯 */
.foot { border-top: 1px solid var(--line); color: var(--ink-sub); font-size: 12.5px; padding: 18px 24px 32px; text-align: center; }
.foot p { margin: 0; max-width: 720px; margin: 0 auto; }
.foot .foot-links { margin-top: 6px; }

/* トップの札 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.card { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-panel); color: var(--ink); box-shadow: var(--shadow); }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card b { display: block; color: var(--accent); margin-bottom: 2px; }
.card span { font-size: 13px; color: var(--ink-sub); }
.kbd, kbd { display: inline-block; font-family: var(--mono); font-size: 0.85em; padding: 0 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-panel); }

/* 狭い画面 */
@media (max-width: 980px) {
  .toc { display: none; }
}
@media (max-width: 760px) {
  .menu-btn { display: inline-block; }
  .brand-sub { display: none; }
  .search { width: auto; flex: 1; }
  .sidebar { position: fixed; left: 0; top: 56px; height: calc(100vh - 56px); background: var(--bg-panel); transform: translateX(-100%); transition: transform 0.18s; z-index: 40; width: min(300px, 86vw); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,0.35); }
  .content { padding: 16px 16px 48px; }
  .page h1 { font-size: 23px; }
  body { font-size: 15px; }
  table { font-size: 13px; }
  td:first-child { white-space: normal; }
}
