:root {
  color-scheme: dark;
  --bg: #0d0e0c;
  --bg-alt: #10110f;
  --surface: #121411;
  --surface-2: #181a16;
  --text: #ecebe4;
  --text-soft: #c9cac2;
  --muted: #9a9d94;
  --subtle: #7d8077;
  --border: #262924;
  --border-strong: #3a3d36;
  --lead: #b9bab2;
  /* 文字色として使うアクセント */
  --accent: #ecaa4b;
  --accent-hover: #f6c67c;
  /* ボタンなど塗りに使うアクセント（両テーマ共通） */
  --accent-fill: #ecaa4b;
  --accent-fill-hover: #f6c67c;
  --accent-contrast: #0d0e0c;
  --accent-soft: rgba(236, 170, 75, 0.1);
  --accent-line: rgba(236, 170, 75, 0.35);
  /* 強調の下半分に敷く色 */
  --accent-mark: rgba(236, 170, 75, 0.22);
  --table-head: #20231d;
  --hint: #7cc98a;
  --hint-line: rgba(124, 201, 138, 0.35);
  --caution: #ee8a73;
  --caution-line: rgba(238, 138, 115, 0.4);
  --info: #8db6dc;
  --info-line: rgba(141, 182, 220, 0.35);
  --grid-line: #1a1c18;
  --header-bg: rgba(13, 14, 12, 0.85);
  --terminal-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  --max: 1248px;
  --font-sans: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Zen Kaku Gothic New", "BIZ UDGothic", monospace;
}

/* ライトテーマ（ヘッダーのボタンで切り替え。<html data-theme="light">） */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f6f1;
  --bg-alt: #efeee7;
  --surface: #ffffff;
  --surface-2: #f1f0ea;
  --text: #1a1b17;
  --text-soft: #3b3d37;
  --muted: #5a5d55;
  --subtle: #6b6e65;
  --border: #e0dfd7;
  --border-strong: #c6c5bc;
  --lead: #4a4c45;
  --accent: #95600f;
  --accent-hover: #7a4e0c;
  --accent-soft: rgba(236, 170, 75, 0.14);
  --accent-line: rgba(149, 96, 15, 0.35);
  --accent-mark: rgba(236, 170, 75, 0.32);
  --table-head: #e8e7de;
  --hint: #2f7a45;
  --hint-line: rgba(47, 122, 69, 0.35);
  --caution: #b0432c;
  --caution-line: rgba(176, 67, 44, 0.35);
  --info: #2f5f8a;
  --info-line: rgba(47, 95, 138, 0.35);
  --grid-line: #e8e7df;
  --header-bg: rgba(247, 246, 241, 0.85);
  --terminal-shadow: 0 30px 80px rgba(26, 27, 23, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

.mono {
  font-family: var(--font-mono);
}

.hl {
  color: var(--accent);
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--text);
}

.logo-mark {
  width: 10px;
  height: 10px;
  background: var(--accent-fill);
}

.nav {
  display: flex;
  gap: 36px;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.15s;
}

.nav a:hover,
.nav a[aria-current] {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 28px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ダークのときは太陽（ライトへ）、ライトのときは月（ダークへ）を表示する */
.theme-toggle .icon-moon,
:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 128px 0 136px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}

.hero .container {
  position: relative;
}

.eyebrow,
.section-index {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 32px 0 0;
  font-size: clamp(2.25rem, 6.6vw, 6rem);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.02em;
}

/* 見出しを1行ずつ表示し、狭い画面でも語句の途中で折り返さない */
.hero h1 .line {
  display: block;
}

.hero h1 .line > span {
  display: inline-block;
}

.hero-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 80px;
  align-items: start;
  margin-top: 72px;
}

.hero-text {
  padding-top: 8px;
}

.lead {
  margin: 0 0 40px;
  color: var(--lead);
  font-size: 1.125rem;
  line-height: 2;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ターミナル風のパネルは、どちらのテーマでも暗い配色で表示する */
.terminal {
  --accent: #ecaa4b;
  --subtle: #7d8077;
  background: #121411;
  color: #ecebe4;
  border: 1px solid #2a2d27;
  box-shadow: var(--terminal-shadow);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid #22251f;
}

.terminal-bar > span:not(.terminal-title) {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34372f;
}

.terminal-title {
  margin-left: 12px;
  font-size: 0.75rem;
  color: var(--subtle);
}

.terminal-body {
  padding: 24px 28px 28px;
  font-size: 0.875rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.terminal-body p {
  margin: 0;
}

.terminal-body .dim {
  padding-left: 1.2em;
  color: #7f8279;
}

.terminal-done {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px !important;
  color: #b9bab2;
}

.terminal-done svg {
  flex: none;
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 18px;
  margin-left: 4px;
  vertical-align: -3px;
  background: var(--accent-fill);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 15px 27px;
  border: 1px solid transparent;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent-fill);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  background: var(--accent-fill-hover);
  color: var(--accent-contrast);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 500;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}

.text-link svg {
  color: var(--accent);
  transition: transform 0.15s;
}

.text-link:hover svg {
  transform: translateX(3px);
}

/* Sections */
.section {
  padding: 120px 0;
  border-top: 1px solid var(--border);
}

.section.page {
  padding: 96px 0 120px;
  border-top: none;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 56px;
}

.section-head-row {
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
}

.section-head-row > div {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Topics */
.topics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.topic {
  padding: 40px 40px 0;
  border-left: 1px solid var(--border);
}

.topic:first-child {
  padding-left: 0;
  border-left: none;
}

.topic:last-child {
  padding-right: 0;
}

.topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--accent);
}

.topic-head span {
  font-size: 0.75rem;
  color: var(--subtle);
}

.topic h3 {
  margin: 32px 0 16px;
  font-size: 1.5rem;
  font-weight: 700;
}

.topic p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.95;
}

/* Article list */
.article-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.article-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 56px;
  gap: 40px;
  align-items: center;
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.article-row:hover {
  color: var(--text);
}

.article-row-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--subtle);
}

.article-row-label {
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.article-row-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-row-title {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.5;
  transition: color 0.15s;
}

.article-row:hover .article-row-title {
  color: var(--accent);
}

.article-row-text {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.9;
}

.article-row-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.article-row:hover .article-row-arrow {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-contrast);
}

.page-lead {
  margin: -32px 0 48px;
  color: var(--muted);
}

/* About */
/* 左に見出し、右に本文 */
.about {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 96px;
  align-items: start;
}

.about .section-head {
  margin-bottom: 0;
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 36px;
}

.about-text p {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.0625rem;
  line-height: 2.05;
}

.about-text .about-note {
  margin-top: 8px;
  color: var(--subtle);
  font-size: 0.875rem;
  line-height: 1.9;
}

.info {
  margin: 0;
  border: 1px solid var(--border);
}

.info div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}

.info div:last-child {
  border-bottom: none;
}

.info dt {
  flex: none;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.info dd {
  margin: 0;
  min-width: 0;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.info dd a {
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.info dd a:hover {
  color: var(--accent);
}

/* 404 */
.notfound {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.notfound p {
  margin: 0 0 16px;
  color: var(--muted);
}

/* Prose (privacy policy, articles) */
.prose {
  max-width: 828px;
  color: var(--text-soft);
  line-height: 2;
}

.prose h1 {
  margin: 24px 0 32px;
  color: var(--text);
  font-size: clamp(1.75rem, 4vw, 2.625rem);
  font-weight: 900;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.prose h2 {
  margin: 72px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 1.375rem;
  line-height: 1.5;
}

.prose h3 {
  margin: 40px 0 12px;
  color: var(--text);
  font-size: 1.125rem;
}

.prose strong {
  color: var(--text);
}

.prose p,
.prose ol,
.prose ul {
  margin: 0 0 20px;
}

.prose ol,
.prose ul {
  padding-left: 1.5em;
}

.prose li {
  margin-bottom: 6px;
}

.prose li::marker {
  color: var(--subtle);
}

/* 箇条書き：黒丸の代わりにアクセント色の短い線 */
.prose ul {
  padding-left: 0;
  list-style: none;
}

.prose ul > li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 28px;
}

.prose ul > li::before {
  content: "";
  position: absolute;
  top: calc(1em - 1px);
  left: 2px;
  width: 12px;
  height: 2px;
  background: var(--accent-fill);
}

/* 番号付きリスト：目次と同じ等幅の「01」（ステップ表示・目次・パンくずは除く） */
.prose ol:not(.steps ol, .toc ol, .breadcrumbs ol) {
  padding-left: 0;
  list-style: none;
  counter-reset: item;
}

.prose ol:not(.steps ol, .toc ol, .breadcrumbs ol) > li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 36px;
  counter-increment: item;
}

.prose ol:not(.steps ol, .toc ol, .breadcrumbs ol) > li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  /* 本文 1rem × 2 の行の高さに合わせる */
  line-height: 2rem;
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 4px;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose .info {
  margin: 8px 0 20px;
}

.prose .info dd {
  text-align: left;
}

.dates {
  margin-top: 56px !important;
  color: var(--subtle);
  font-size: 0.875rem;
  text-align: right;
}

.eyebrow-sep {
  margin: 0 0.75em;
  color: var(--subtle);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: -16px 0 40px !important;
  color: var(--subtle);
  font-size: 0.875rem;
}

.article-meta time {
  font-family: var(--font-mono);
}

/* 記事本文の h2：「## 01」のラベルと罫線の行を、見出しの上に置く（まとめなど .unnumbered を付けた見出しは「##」だけ） */
.article-body {
  counter-reset: section;
}

.article-body > h2 {
  position: relative;
  margin-bottom: 24px;
  padding: 0;
  border-bottom: none;
  font-size: 1.625rem;
  line-height: 1.45;
  letter-spacing: -0.01em;
  /* h3 のサブ番号（5.1 など）を章ごとに数え直す */
  counter-reset: subsection;
}

.article-body > h2::before {
  content: "##";
  position: relative;
  z-index: 1;
  display: block;
  width: fit-content;
  margin-bottom: 12px;
  /* ラベルの後ろだけ罫線を隠す */
  padding-right: 14px;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1;
}

.article-body > h2:not(.unnumbered)::before {
  counter-increment: section;
  content: "## " counter(section, decimal-leading-zero);
}

/* ラベルの行の高さの中央に、横いっぱいの罫線を引く */
.article-body > h2::after {
  content: "";
  position: absolute;
  top: calc(0.40625rem - 0.5px);
  right: 0;
  left: 0;
  height: 1px;
  background: var(--border);
}

/* 記事本文の h3：頭に「5.1」のような章番号を引き継いだサブ番号を付ける */
.article-body > h3 {
  position: relative;
  padding-left: 40px;
}

.article-body > h3::before {
  counter-increment: subsection;
  content: counter(section) "." counter(subsection);
  position: absolute;
  /* 等幅の数字は和文より上に寄って見えるので、少し下げる */
  top: 2px;
  left: 0;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  /* 見出し1行目（1.125rem × 1.6）と同じ高さにして、1行目の中央にそろえる */
  line-height: 1.8rem;
}

/* 段落の中の強調：下半分に薄いアクセント色を敷く（表・囲み枠・結論の中は付けない） */
.article-body > p strong {
  padding: 0 2px;
  background: linear-gradient(transparent 58%, var(--accent-mark) 58%);
}

.article-back {
  margin: 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.article-back a {
  text-decoration: none;
}

.prose :not(pre) > code {
  padding: 0.15em 0.45em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.toc {
  margin: 0 0 48px;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.prose .toc-title {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
}

.prose .toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

/* 本文の見出し番号と同じ番号を振る */
.prose .toc li {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  margin-bottom: 2px;
}

.prose .toc li::before {
  flex: none;
  min-width: 1.5em;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.prose .toc a[aria-current],
.prose .toc li:has(a[aria-current])::before {
  color: var(--accent);
}

.prose .toc li:not(.unnumbered)::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
}

.prose .toc li.unnumbered::before {
  content: "--";
}

.prose .toc a {
  color: var(--text-soft);
  text-decoration: none;
}

.prose .toc a:hover {
  color: var(--accent);
}

.codeblock {
  margin: 20px 0 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.codeblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.codeblock pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
}

.codeblock.prompt {
  border-color: var(--accent-line);
}

.codeblock.prompt .codeblock-head {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.codeblock.prompt pre {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* 種類ごとの色は --note-color / --note-line で切り替える（初期値は hint） */
.note {
  --note-color: var(--hint);
  --note-line: var(--hint-line);
  margin: 20px 0 28px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--note-line);
  border-left: 3px solid var(--note-color);
}

.note-caution {
  --note-color: var(--caution);
  --note-line: var(--caution-line);
}

.note-info {
  --note-color: var(--info);
  --note-line: var(--info-line);
}

.note-check {
  --note-color: var(--accent);
  --note-line: var(--accent-line);
}

.prose .note p,
.prose .note ul {
  margin: 0;
}

/* .prose .note p { margin: 0 } より詳細度を高くして、要素どうしの間隔を空ける */
.prose .note > :not(:first-child) {
  margin-top: 12px;
}

.prose .note-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--note-color);
  font-weight: 700;
}

.note-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1;
  transform: translateY(-1px);
}

.note .codeblock {
  margin-bottom: 0;
}

.note summary {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.note details .table-wrap {
  margin: 12px 0 0;
}

/* 記事内のスクリーンショット（Screenshot.astro）。本文では幅を半分にし、クリックで拡大する */
.screenshot {
  margin: 16px 0 24px;
}

.screenshot-open {
  position: relative;
  display: block;
  width: 50%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

/* 明るい画面の画像でも、ダークテーマの地から浮かないよう枠を付ける */
.screenshot-open img {
  display: block;
  width: 100%;
  border: 1px solid var(--border-strong);
  transition: border-color 0.15s;
}

.screenshot-open:hover img {
  border-color: var(--accent);
}

.screenshot-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.6;
}

.screenshot-dialog {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: none;
  overflow: visible;
  cursor: zoom-out;
}

.screenshot-dialog::backdrop {
  background: rgb(0 0 0 / 0.8);
}

.screenshot-dialog img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 92vh;
}

.screenshot-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

html:has(.screenshot-dialog[open]) {
  overflow: hidden;
}

/* スマホでは半分だと文字が読めないので、本文の幅いっぱいに表示する */
@media (max-width: 640px) {
  .screenshot-open {
    width: 100%;
  }
}

.table-wrap {
  margin: 20px 0 28px;
  overflow-x: auto;
}

.prose table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.8;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

/* 見出し行は濃い地とアクセントの下線で、本文の行と区別する */
.prose thead th {
  background: var(--table-head);
  border-bottom: 2px solid var(--accent-line);
  color: var(--text);
  font-size: 0.875rem;
  white-space: nowrap;
}

/* 行の見出し（1列目）は地を敷かず、太字だけで示す */
.prose tbody th {
  color: var(--text);
  white-space: nowrap;
}

/* Footer */
.site-footer {
  padding: 64px 0 32px;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px 64px;
}

.footer-brand p {
  max-width: 320px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.9;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 32px 64px;
}

.footer-group-title {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-group ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a[aria-current] {
  color: var(--text);
}

.copyright {
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.8125rem;
}

/* Responsive */
@media (max-width: 960px) {
  .hero {
    padding: 96px 0 104px;
  }

  .hero-body {
    grid-template-columns: 1fr;
    gap: 56px;
    margin-top: 56px;
  }

  .section {
    padding: 88px 0;
  }

  .topics {
    grid-template-columns: 1fr;
    border-top: none;
  }

  .topic,
  .topic:first-child,
  .topic:last-child {
    padding: 32px 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .topic h3 {
    margin-top: 20px;
  }

  .about {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .about-text {
    padding-top: 40px;
  }
}

@media (max-width: 720px) {
  .header-inner {
    height: 60px;
  }

  .header-actions {
    gap: 16px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .nav {
    gap: 20px;
  }

  .hero {
    padding: 72px 0 80px;
  }

  .hero h1 {
    margin-top: 24px;
  }

  .lead {
    font-size: 1rem;
  }

  .terminal-body {
    padding: 20px;
    font-size: 0.8125rem;
  }

  .section {
    padding: 72px 0;
  }

  .section.page {
    padding: 56px 0 88px;
  }

  .section-head {
    margin-bottom: 40px;
  }

  .section-head-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .article-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 28px 0;
  }

  .article-row-meta {
    flex-direction: row;
    gap: 16px;
  }

  .article-row-title {
    font-size: 1.25rem;
  }

  .article-row-arrow {
    display: none;
  }

  .page-lead {
    margin-top: -24px;
  }

  .info div {
    padding: 16px 20px;
  }

  .prose h2 {
    margin-top: 56px;
  }

  .article-body > h2 {
    font-size: 1.375rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }
}

/* サイト名が長いので、狭い画面ではヘッダーの文字と余白を詰めて1行に収める */
@media (max-width: 400px) {
  .logo {
    gap: 8px;
    font-size: 0.9375rem;
  }

  .logo-mark {
    width: 8px;
    height: 8px;
  }

  .header-actions {
    gap: 12px;
  }

  .theme-toggle {
    width: 34px;
    height: 34px;
  }
}

/* Article layout：狭い画面は1列（見出し → 目次 → 本文 → 記事末尾）、広い画面は目次を右の列に置いて追従させる */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.article-cover {
  display: block;
  width: 100%;
  margin: 0 0 48px;
  border: 1px solid var(--border);
}

.article-footer {
  display: flex;
  flex-direction: column;
  gap: 48px;
  max-width: 828px;
  margin-top: 72px;
}

@media (min-width: 1120px) {
  .article-layout {
    grid-template-columns: minmax(0, 828px) 272px;
    justify-content: space-between;
    column-gap: 64px;
  }

  .article-header,
  .article-body,
  .article-footer {
    grid-column: 1;
  }

  .article-aside {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .article-aside .toc {
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 136px);
    margin: 0;
    padding: 20px 22px;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.8;
  }

  .article-aside .toc li {
    margin-bottom: 6px;
  }
}

/* 結論の枠 */
.summary {
  margin: 0 0 40px;
  padding: 22px 26px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

.prose .summary-title {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
}

.prose .summary-body > :last-child {
  margin-bottom: 0;
}

.prose .summary strong {
  color: var(--text);
}

/* ステップ：アクセント色で塗った丸い番号を、アクセント色の縦線でつなぐ */
.steps {
  margin: 20px 0 28px;
}

.prose .steps ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.prose .steps li {
  position: relative;
  margin: 0;
  padding: 0 0 28px 52px;
  counter-increment: step;
}

.prose .steps li:last-child {
  padding-bottom: 0;
}

/* 丸の高さを本文の1行（1rem × 2）と同じにして、1行目の中央にそろえる */
.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-fill);
  border-radius: 50%;
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}

/* 番号どうしを縦線でつなぐ */
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 38px;
  bottom: 6px;
  left: 15px;
  width: 2px;
  background: var(--accent-line);
}

/* 記事へのリンクカード */
.prose .link-card {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 24px 0 32px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}

.prose .link-card:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.link-card-thumb {
  display: block;
  width: 100%;
}

.link-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.link-card-label {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.link-card-title {
  font-weight: 700;
  line-height: 1.6;
}

.link-card:hover .link-card-title {
  color: var(--accent);
}

.link-card-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.link-card-date {
  color: var(--subtle);
  font-size: 0.75rem;
}

/* 記事末尾：タグ */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.article-tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

/* 記事末尾：著者 */
.author-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.author-mark {
  width: 40px;
  height: 40px;
  background:
    linear-gradient(var(--accent-fill), var(--accent-fill)) center / 12px 12px no-repeat,
    var(--surface-2);
  border: 1px solid var(--border-strong);
}

.author-body p {
  margin: 0;
}

.author-label {
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.author-name {
  margin-top: 4px !important;
  color: var(--text);
  font-weight: 700;
}

.author-text {
  margin-top: 8px !important;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.9;
}

.author-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8125rem;
  text-decoration: none;
}

/* 記事末尾：前後の記事 */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}

.pager-link:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.pager-newer {
  grid-column: 2;
  text-align: right;
}

.pager-dir {
  color: var(--subtle);
  font-size: 0.75rem;
}

.pager-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.7;
}

.pager-link:hover .pager-title {
  color: var(--accent);
}

/* 記事末尾：関連記事 */
.related-title {
  margin: 12px 0 28px;
  font-size: 1.375rem;
  line-height: 1.5;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.related-card:hover {
  color: var(--text);
}

.related-card img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.related-card:hover img {
  border-color: var(--accent-line);
}

.related-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  color: var(--subtle);
  font-size: 0.75rem;
}

.related-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.7;
}

.related-card:hover .related-card-title {
  color: var(--accent);
}

@media (max-width: 720px) {
  .article-cover {
    margin-bottom: 40px;
  }

  .article-footer {
    margin-top: 56px;
  }

  .prose .link-card {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
  }

  .link-card-text {
    display: none;
  }

  .author-box {
    padding: 22px;
    gap: 16px;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-newer {
    grid-column: 1;
  }

  .related-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

/* パンくずリスト */
.breadcrumbs {
  margin-bottom: 40px;
  font-size: 0.75rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs li {
  display: flex;
  min-width: 0;
  color: var(--subtle);
}

.breadcrumbs li + li::before {
  content: "/";
  margin: 0 0.75em;
  color: var(--border-strong);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

/* 今いるページ（記事タイトルなど）は1行に収める */
.breadcrumbs [aria-current] {
  overflow: hidden;
  max-width: 32em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow a {
  color: inherit;
  text-decoration: none;
}

.eyebrow a:hover {
  color: var(--accent-hover);
}

/* トップのテーマカード（カテゴリーへのリンク） */
.topic {
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
}

.topic:hover {
  color: var(--text);
}

.topic h3 {
  transition: color 0.15s;
}

.topic:hover h3 {
  color: var(--accent);
}

.topic-link {
  margin-top: 24px;
  color: var(--accent);
  font-size: 0.8125rem;
}

.topic-link.is-empty {
  color: var(--subtle);
}

.about-text .text-link {
  margin-top: 8px;
  color: var(--accent);
}

/* カテゴリーの切り替え */
.category-nav {
  margin: 0 0 32px;
}

.category-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-nav a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.category-nav a:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.category-nav a[aria-current] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

.category-nav-count {
  color: var(--subtle);
  font-size: 0.75rem;
}

.category-nav a[aria-current] .category-nav-count {
  color: inherit;
}

.category-index {
  display: flex;
  align-items: center;
  gap: 10px;
}

.empty-state {
  padding: 48px 32px;
  border: 1px dashed var(--border-strong);
  text-align: center;
}

.empty-state p {
  margin: 0 0 12px;
  color: var(--muted);
}

.empty-state p.mono {
  color: var(--subtle);
  font-size: 0.8125rem;
}

.empty-state .text-link {
  color: var(--accent);
}

/* はじめての方へ（ほかのページと同じく左寄せのまま、本文の幅だけ絞る） */
.start > * {
  max-width: 960px;
}

.start-section {
  margin-top: 72px;
}

.start-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.375rem;
  line-height: 1.5;
}

.start-title .mono {
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.start-text {
  margin: 0 0 32px;
  color: var(--muted);
}

.requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.requirements li {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.requirements-check {
  flex: none;
  color: var(--accent);
  font-size: 0.875rem;
  line-height: 1.8;
}

.requirements strong {
  display: block;
  color: var(--text);
}

.requirements-note {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

.route {
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 32px;
}

.route-item:last-child {
  padding-bottom: 0;
}

/* ステップの番号を縦線でつなぐ */
.route-item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 56px;
  bottom: 8px;
  left: 24px;
  width: 1px;
  background: var(--border-strong);
}

.route-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 0.875rem;
}

.route-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0 14px;
  font-size: 1.125rem;
  font-weight: 700;
}

.route-optional {
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  color: var(--subtle);
  font-size: 0.6875rem;
  font-weight: 400;
}

.route-choose {
  padding: 1px 8px;
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 400;
}

/* 1つのステップに2本並ぶとき（どちらか一方を選ぶ） */
.route-link + .route-link {
  margin-top: 12px;
}

.route-link {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}

.route-link:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.route-link img {
  display: block;
  width: 100%;
}

.route-link-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--subtle);
  font-size: 0.75rem;
}

.route-title {
  font-weight: 700;
  line-height: 1.6;
}

.route-link:hover .route-title {
  color: var(--accent);
}

.route-note {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.9;
}

.how-to-read {
  margin: 0;
}

.how-to-read div {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0;
}

.how-to-read div + div {
  border-top: 1px solid var(--border);
}

.how-to-read dt {
  color: var(--text);
  font-weight: 700;
}

.how-to-read dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.95;
}

.how-to-read code {
  padding: 0.1em 0.4em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.legend {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 0 10px;
  border: 1px solid;
  border-left-width: 3px;
  font-size: 0.8125rem;
  line-height: 1.9;
}

.legend-hint {
  border-color: var(--hint-line);
  border-left-color: var(--hint);
  color: var(--hint);
}

.legend-caution {
  border-color: var(--caution-line);
  border-left-color: var(--caution);
  color: var(--caution);
}

.legend-info {
  border-color: var(--info-line);
  border-left-color: var(--info);
  color: var(--info);
}

.legend-check {
  border-color: var(--accent-line);
  border-left-color: var(--accent);
  color: var(--accent);
}

.start-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 72px;
  padding: 28px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.start-next p {
  margin: 0;
  color: var(--muted);
}

/* このサイトについて */
.about-page h2:first-child {
  margin-top: 0;
}

.operator {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  padding: 24px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.prose .operator p {
  margin: 0;
}

.prose .operator .operator-name {
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 700;
}

/* ヘッダーにリンクが3つ入らない幅では「記事」だけにする（ほかはトップとフッターから開ける） */
@media (max-width: 640px) {
  .nav a[href="/start"],
  .nav a[href="/about"] {
    display: none;
  }
}

@media (max-width: 960px) {
  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .breadcrumbs {
    margin-bottom: 28px;
  }

  .breadcrumbs [aria-current] {
    max-width: 16em;
  }

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 24px;
  }

  .start-section {
    margin-top: 56px;
  }

  .requirements {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-item {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 14px;
  }

  .route-item:not(:last-child)::after {
    top: 44px;
    left: 18px;
  }

  .route-num {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
  }

  .route-step {
    margin-top: 4px;
    font-size: 1rem;
  }

  .route-link {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .how-to-read div {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .start-next {
    padding: 22px;
  }

  .operator {
    padding: 20px;
    gap: 16px;
  }
}
