/* =========================================================
   OIT Birdman ホームページ管理マニュアル
   docs-viewer.pen のデザイントークンを再現
   ========================================================= */

:root {
  --accent: #1366D6;
  --accent-dark: #0B4FAA;
  --accent-soft: #E4EFFC;
  --bg: #FFFFFF;
  --border: #E2E8EF;
  --code-bg: #0E1B2A;
  --code-text: #D6E4F2;
  --sky: #5BA7E8;
  --success: #1E9E6A;
  --surface: #F5F8FB;
  --surface-2: #EAF1F8;
  --text-muted: #6B7886;
  --text-primary: #0E1B2A;
  --text-secondary: #5B6B7C;
  --warn: #E0A100;
  --kicker: #2E78BD;
  --btn-primary-bg: #1366D6;
  --btn-primary-bg-hover: #0B4FAA;
  --footer-muted: #8294A6;
  --radius: 12px;
  --radius-sm: 8px;
  --font-heading: "Inter", "Noto Sans JP", system-ui, sans-serif;
  --font-body: "Noto Sans JP", "Inter", system-ui, sans-serif;
  --header-h: 64px;
  --max-w: 1440px;
  --header-bg: rgba(255, 255, 255, 0.85);
  --mark-text: #0E1B2A;
  --inline-code-bg: #EAF1F8;
  --inline-code-text: #0B4FAA;
  --inline-code-border: #D3E0EE;
  --accent-on-soft: #1366D6;
}

/* ---------- ダークテーマ ---------- */
:root[data-theme="dark"] {
  --accent: #3B82F6;
  --accent-dark: #60A5FA;
  --accent-soft: #16314D;
  --bg: #0D1722;
  --border: #25323F;
  --code-bg: #060B12;
  --code-text: #D6E4F2;
  --sky: #5BA7E8;
  --surface: #15212E;
  --surface-2: #1C2A38;
  --text-muted: #7C8A99;
  --text-primary: #E8EFF6;
  --text-secondary: #A9B7C6;
  --warn: #E0A100;
  --success: #2BB37C;
  --header-bg: rgba(13, 23, 34, 0.85);
  --mark-text: #0E1B2A;
  --inline-code-bg: #213A52;
  --inline-code-text: #9CC6FF;
  --inline-code-border: #35506C;
  --accent-on-soft: #8FBEFF;
  --kicker: #5BA7E8;
  --btn-primary-bg: #2563EB;
  --btn-primary-bg-hover: #1B4DCB;
  --footer-muted: #8294A6;
}

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---------- Header (共通) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w);
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--sky));
  display: grid; place-items: center;
  color: #fff; flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 15px; color: var(--text-primary); }
.brand-sub { font-size: 11px; color: var(--text-muted); }

.header-nav { display: flex; align-items: center; gap: 28px; }
.header-nav a { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.header-nav a:hover { color: var(--text-primary); text-decoration: none; }
.header-nav a.active { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-heading); font-weight: 600; font-size: 14px;
  border-radius: var(--radius-sm);
  padding: 9px 16px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-primary-bg); color: #fff; }
.btn-primary:hover { background: var(--btn-primary-bg-hover); }
.btn-ghost { background: var(--bg); color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn svg { width: 16px; height: 16px; }

.header-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; min-width: 200px;
}
.header-search svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.header-search input {
  border: none; background: transparent; outline: none;
  font-family: var(--font-body); font-size: 13px; color: var(--text-primary);
  width: 100%;
}

.icon-btn {
  width: 38px; height: 38px; display: none; place-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; color: var(--text-primary);
}
.icon-btn svg { width: 20px; height: 20px; }

/* テーマ切り替えボタン（常時表示） */
.theme-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; color: var(--text-secondary);
  transition: background .15s, color .15s, border-color .15s;
}
.theme-btn:hover { background: var(--surface); color: var(--text-primary); }
.theme-btn svg { width: 19px; height: 19px; }

/* =========================================================
   Landing
   ========================================================= */
.section { max-width: var(--max-w); margin: 0 auto; padding: 72px 64px; }
.kicker {
  font-family: var(--font-heading); font-weight: 700; font-size: 13px;
  letter-spacing: 1px; color: var(--kicker); text-transform: uppercase;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--bg) 70%);
}
.hero-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 88px 64px;
  display: flex; align-items: center; gap: 56px;
}
.hero-left { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.hero-title {
  font-family: var(--font-heading); font-weight: 800; margin: 0;
  font-size: 48px; line-height: 1.15; letter-spacing: -0.5px; color: var(--text-primary);
}
.hero-title .en {
  display: block; font-size: 18px; font-weight: 600; letter-spacing: 0;
  color: var(--accent); margin-top: 12px;
}
.hero-sub { font-size: 16px; color: var(--text-secondary); max-width: 460px; margin: 0; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }

/* Getting started */
.getting-started { display: flex; gap: 64px; }
.gs-left { width: 360px; flex: none; }
.gs-left h2 { font-family: var(--font-heading); font-weight: 800; font-size: 28px; margin: 8px 0 0; }
.gs-right { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.gs-right p { margin: 0; font-size: 15px; color: var(--text-secondary); line-height: 1.85; }

/* Chapters */
.chapters { background: var(--surface); }
.chapters-head h2 { font-family: var(--font-heading); font-weight: 800; font-size: 28px; margin: 8px 0 6px; }
.chapters-head p { margin: 0; color: var(--text-secondary); font-size: 15px; }
.card-grid {
  margin-top: 36px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.chapter-card {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.chapter-card:hover {
  text-decoration: none; transform: translateY(-3px);
  box-shadow: 0 12px 28px -14px rgba(14,27,42,0.25); border-color: var(--sky);
}
.card-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent-on-soft);
  display: grid; place-items: center;
}
.card-icon svg { width: 26px; height: 26px; }
.card-num { font-family: var(--font-heading); font-weight: 700; font-size: 12px; letter-spacing: 1px; color: var(--text-muted); }
.card-title { font-family: var(--font-heading); font-weight: 700; font-size: 20px; color: var(--text-primary); margin: 2px 0 0; }
.card-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin: 4px 0 0; }
.card-more { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-family: var(--font-heading); font-weight: 700; font-size: 14px; margin-top: auto; }
.card-more svg { width: 15px; height: 15px; }

/* FAQ */
.faq { display: flex; gap: 64px; }
.faq-left { width: 340px; flex: none; }
.faq-left h2 { font-family: var(--font-heading); font-weight: 800; font-size: 28px; margin: 8px 0 12px; }
.faq-left p { color: var(--text-secondary); font-size: 14px; margin: 0; }
.faq-list { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-q {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 18px 22px; font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.faq-q .q-icon { width: 18px; height: 18px; color: var(--accent); flex: none; }
.faq-q .chev { margin-left: auto; width: 18px; height: 18px; color: var(--text-muted); transition: transform .2s; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.faq-a-inner { padding: 0 22px 18px 52px; color: var(--text-secondary); font-size: 14px; }
.faq-item.open .faq-a { max-height: 240px; }

/* Footer (共通) */
.site-footer { background: var(--code-bg); color: #cfe0f0; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 48px 64px; }
.footer-top { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; }
.footer-brand { max-width: 360px; }
.footer-brand .brand-name { color: #fff; }
.footer-brand p { color: #91a4b8; font-size: 14px; margin: 14px 0 0; line-height: 1.8; }
.footer-cols { display: flex; gap: 64px; }
.footer-col h4 { font-family: var(--font-heading); font-size: 13px; letter-spacing: .5px; color: #fff; margin: 0 0 14px; text-transform: uppercase; }
.footer-col a { display: block; color: #91a4b8; font-size: 14px; margin-bottom: 10px; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 28px 0; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; color: var(--footer-muted); font-size: 13px; flex-wrap: wrap; gap: 8px; }

/* =========================================================
   Docs Viewer
   ========================================================= */
.docs-body {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 286px minmax(0, 1fr) 236px;
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  padding: 28px 22px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.sidebar-search {
  /* PC ではヘッダー検索があるため非表示。モバイル（ドロワー）でのみ表示 */
  display: none; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 24px;
}
.sidebar-search svg { width: 15px; height: 15px; color: var(--text-muted); flex: none; }
.sidebar-search input { border: none; background: transparent; outline: none; font-family: var(--font-body); font-size: 13px; width: 100%; }
.nav-group { margin-bottom: 26px; }
.nav-group-title {
  font-family: var(--font-heading); font-size: 12px; font-weight: 700;
  letter-spacing: .5px; color: var(--text-muted); text-transform: uppercase;
  margin: 0 0 10px; padding: 0 10px;
}
.nav-link {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary); cursor: pointer;
}
.nav-link:hover { background: var(--surface); color: var(--text-primary); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-on-soft); font-weight: 600; }
.nav-link.hidden { display: none; }
.nav-group.hidden { display: none; }

/* 検索サジェスト（本文スニペット） */
.search-pop {
  position: fixed; z-index: 200;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 16px 40px -12px rgba(14,27,42,0.28);
  max-height: 64vh; overflow-y: auto; padding: 6px;
}
.sr-item {
  display: block; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; line-height: 1.5;
}
.sr-item:hover { background: var(--surface); text-decoration: none; }
.sr-doc {
  display: block; font-family: var(--font-heading); font-weight: 700;
  font-size: 13px; color: var(--text-primary); margin-bottom: 3px;
}
.sr-group {
  font-family: var(--font-body); font-weight: 500; font-size: 11px;
  color: var(--text-muted); margin-left: 6px;
}
.sr-count {
  font-family: var(--font-body); font-weight: 600; font-size: 11px;
  color: var(--accent-on-soft); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 8px; margin-left: 4px;
}
.sr-snip { display: block; font-size: 12.5px; color: var(--text-secondary); }
.sr-snip mark { background: #FFF1B8; color: var(--mark-text); padding: 0 1px; border-radius: 2px; }
.sr-empty { padding: 14px; font-size: 13px; color: var(--text-muted); }

/* 本文内ジャンプ時のハイライト */
mark.search-hit {
  background: #FFE58F; color: var(--mark-text); border-radius: 2px;
  padding: 0 2px; box-shadow: 0 0 0 4px #FFE58F66;
  transition: background 1s ease, box-shadow 1s ease;
}
mark.search-hit.fade { background: transparent; box-shadow: none; }

/* Content */
.content { padding: 40px 56px 80px; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb svg { width: 14px; height: 14px; }
.breadcrumb .current { color: var(--accent); }

/* Markdown 本文 */
.markdown { color: var(--text-primary); font-size: 15px; }
.markdown > *:first-child { margin-top: 0; }
.markdown h1 { font-family: var(--font-heading); font-weight: 800; font-size: 32px; letter-spacing: -0.4px; margin: 0 0 18px; line-height: 1.25; }
.markdown h2 {
  font-family: var(--font-heading); font-weight: 700; font-size: 22px; letter-spacing: -0.2px;
  margin: 44px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); scroll-margin-top: 80px;
}
.markdown h3 { font-family: var(--font-heading); font-weight: 700; font-size: 18px; margin: 30px 0 12px; scroll-margin-top: 80px; }
.markdown h4 { font-family: var(--font-heading); font-weight: 700; font-size: 15px; margin: 22px 0 10px; }
.markdown p { margin: 0 0 16px; line-height: 1.85; color: var(--text-secondary); }
.markdown a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.markdown strong { color: var(--text-primary); font-weight: 700; }
.markdown ul, .markdown ol { margin: 0 0 18px; padding-left: 24px; color: var(--text-secondary); line-height: 1.85; }
.markdown li { margin-bottom: 6px; }
.markdown li::marker { color: var(--accent); }
.markdown blockquote {
  margin: 0 0 18px; padding: 14px 18px;
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); color: var(--text-secondary);
}
.markdown blockquote p { margin: 0; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }
.markdown img { border-radius: var(--radius); border: 1px solid var(--border); margin: 8px 0 18px; }

/* inline code */
.markdown :not(pre) > code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em; background: var(--inline-code-bg); color: var(--inline-code-text);
  border: 1px solid var(--inline-code-border);
  padding: 1px 6px; border-radius: 5px;
}
/* code block */
.markdown pre {
  background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius); padding: 20px 22px; overflow-x: auto;
  margin: 0 0 22px; font-size: 13.5px; line-height: 1.7;
  position: relative;
}
.markdown pre code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: none; color: inherit; padding: 0;
}
.code-copy {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,0.08); color: #cfe0f0; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; opacity: 0; transition: opacity .15s;
}
.markdown pre:hover .code-copy { opacity: 1; }
.code-copy svg { width: 13px; height: 13px; }

/* tables */
.markdown table { width: 100%; border-collapse: collapse; margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.markdown thead { background: var(--surface); }
.markdown th { text-align: left; font-family: var(--font-heading); font-weight: 700; color: var(--text-primary); padding: 12px 16px; border-bottom: 1px solid var(--border); }
.markdown td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.markdown tbody tr:last-child td { border-bottom: none; }

/* prev / next */
.prev-next { display: flex; gap: 16px; margin-top: 48px; }
.pn-card {
  flex: 1; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.pn-card:hover { text-decoration: none; border-color: var(--sky); background: var(--surface); }
.pn-card.next { text-align: right; align-items: flex-end; }
.pn-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.pn-label svg { width: 14px; height: 14px; }
.pn-title { font-family: var(--font-heading); font-weight: 700; font-size: 15px; color: var(--accent); }

/* On this page */
.on-this-page {
  border-left: 1px solid var(--border);
  padding: 32px 24px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.otp-title { font-family: var(--font-heading); font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 14px; }
.otp-list { display: flex; flex-direction: column; gap: 2px; border-left: 2px solid var(--border); }
.otp-list a {
  font-size: 13px; color: var(--text-secondary); padding: 5px 0 5px 14px;
  margin-left: -2px; border-left: 2px solid transparent; line-height: 1.5;
}
.otp-list a:hover { color: var(--text-primary); text-decoration: none; }
.otp-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.otp-list a.lvl-3 { padding-left: 26px; font-size: 12.5px; }
.help-box { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.help-box h4 { font-family: var(--font-heading); font-size: 14px; margin: 0 0 6px; }
.help-box p { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.7; }
.help-box a { font-size: 13px; }
.edit-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--text-secondary); }
.edit-link svg { width: 14px; height: 14px; }

.loading { color: var(--text-muted); padding: 40px 0; text-align: center; }

/* mobile sidebar overlay */
.scrim { display: none; }

/* =========================================================
   レスポンシブ
   ========================================================= */
@media (max-width: 1100px) {
  .on-this-page { display: none; }
  .docs-body { grid-template-columns: 286px minmax(0, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .header-nav, .header-search { display: none; }
  .sidebar-search { display: flex; }
  .icon-btn { display: grid; }
  .header-inner { padding: 0 18px; }
  .section { padding: 48px 20px; }
  .hero-inner { flex-direction: column; padding: 40px 20px 44px; gap: 28px; }
  .hero-title { font-size: 34px; }
  .getting-started, .faq { flex-direction: column; gap: 24px; }
  .gs-left, .faq-left { width: auto; }
  .card-grid { grid-template-columns: 1fr; }
  .footer-inner { padding: 40px 20px; }
  .footer-top { flex-direction: column; gap: 28px; }
  .footer-cols { gap: 48px; }

  /* docs viewer mobile: sidebar becomes a drawer */
  .docs-body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: 280px; height: 100vh; background: var(--bg);
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.15);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(14,27,42,0.4);
  }
  .content { padding: 28px 20px 60px; }
  .markdown h1 { font-size: 28px; }
  .prev-next { flex-direction: column; }
}
