/* Shared article format for ishiwari.net */
:root {
  --article-bg: #fafbfd;
  --article-card: #ffffff;
  --article-border: #e2e6ef;
  --article-accent: #4361ee;
  --article-accent-2: #7b2ff7;
  --article-text: #23272f;
  --article-sub: #636b7e;
  --article-code-bg: #f0f2f8;
  --article-toc-bg: #f5f6fa;
  --article-cover-1: #1a1a2e;
  --article-cover-2: #16213e;
  --article-cover-3: #0f3460;
}

:root[data-theme="dark"] {
  --article-bg: #0b1020;
  --article-card: #131a33;
  --article-border: #24305f;
  --article-accent: #7aa2ff;
  --article-accent-2: #c084fc;
  --article-text: #e8ecff;
  --article-sub: #a8b2d9;
  --article-code-bg: #0f1530;
  --article-toc-bg: #10172f;
  --article-cover-1: #111827;
  --article-cover-2: #172554;
  --article-cover-3: #312e81;
}

.article-page,
.article-page * {
  box-sizing: border-box;
}

.article-page {
  margin: 0;
  font-family: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--article-bg);
  color: var(--article-text);
  line-height: 1.8;
  font-size: 15px;
}

.article-cover {
  position: relative;
  background: linear-gradient(135deg, var(--article-cover-1) 0%, var(--article-cover-2) 50%, var(--article-cover-3) 100%);
  color: #fff;
  text-align: center;
  padding: 80px 24px 60px;
}

.article-cover .badge {
  display: inline-block;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 20px;
  padding: 4px 18px;
  font-size: .78rem;
  letter-spacing: .08em;
  color: #c9d5ff;
  margin-bottom: 18px;
}

.article-cover h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 10px;
}

.article-cover h1 span {
  background: linear-gradient(90deg, #00d2ff, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.article-cover .meta {
  color: #b7c1dc;
  font-size: .88rem;
  margin-top: 16px;
  line-height: 1.9;
}

.article-wrapper {
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 900px);
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}

.article-toc {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 250px;
  min-width: 200px;
  height: 100vh;
  overflow-y: auto;
  background: var(--article-toc-bg);
  border-right: 1px solid var(--article-border);
  padding: 24px 14px;
  font-size: .82rem;
}

.article-toc h4 {
  color: var(--article-accent);
  margin: 0 0 12px;
  font-size: .85rem;
  letter-spacing: .08em;
}

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

.article-toc li {
  counter-increment: toc;
  margin-bottom: 2px;
}

.article-toc li a {
  text-decoration: none;
  color: var(--article-sub);
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}

.article-toc li a:hover {
  background: color-mix(in srgb, var(--article-accent) 12%, transparent);
  color: var(--article-text);
}

.article-toc li a::before {
  content: counter(toc) ". ";
  font-weight: 600;
  color: var(--article-accent);
}

.article-main {
  min-width: 0;
  width: 100%;
  padding: 40px 48px 80px;
}

.article-main h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--article-accent);
  border-left: 4px solid var(--article-accent);
  padding-left: 14px;
  margin: 48px 0 18px;
}

.article-main h2:first-of-type {
  margin-top: 0;
}

.article-main h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--article-accent-2);
  margin: 28px 0 10px;
}

.article-main h4 {
  font-size: .98rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--article-text);
}

.article-main p,
.article-main li {
  color: var(--article-text);
}

.article-main section {
  margin-bottom: 12px;
}

.article-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: .88rem;
}

.article-main th,
.article-main td {
  border: 1px solid var(--article-border);
  padding: 8px 12px;
  text-align: left;
}

.article-main th {
  background: var(--article-code-bg);
  font-weight: 600;
  white-space: nowrap;
}

.article-main pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.7;
  margin: 12px 0 20px;
  border: 0;
}

.article-main code {
  font-family: "Fira Code", "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.article-main p code,
.article-main li code,
.article-main td code {
  background: var(--article-code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .84rem;
  color: var(--article-accent-2);
  border: 0;
}

.article-main pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
}

.article-main .card,
.article-main .step,
.article-main .block {
  background: var(--article-card);
  border: 1px solid var(--article-border);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.article-main .steps {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.article-main .note,
.article-main .callout,
.article-main blockquote {
  background: color-mix(in srgb, var(--article-accent) 12%, var(--article-card));
  border-left: 4px solid var(--article-accent);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 14px 0;
  font-size: .9rem;
  color: var(--article-text);
}

.article-main .callout.warn {
  background: color-mix(in srgb, #f0a500 16%, var(--article-card));
  border-color: #f0a500;
}

.article-main .callout strong,
.article-main blockquote strong {
  display: block;
  margin-bottom: 4px;
}

.article-main .mermaid {
  margin: 16px 0 24px;
  text-align: center;
}

.article-main .fig-caption {
  text-align: center;
  font-size: .82rem;
  color: var(--article-sub);
  margin: -14px 0 24px;
  font-style: italic;
}

.article-main ul,
.article-main ol {
  padding-left: 22px;
  margin: 8px 0 14px;
}

.article-main li {
  margin-bottom: 3px;
}

.article-main hr {
  border: none;
  border-top: 1px solid var(--article-border);
  margin: 36px 0;
}

.article-main a {
  color: var(--article-accent);
}

.article-footer {
  text-align: center;
  padding: 20px;
  font-size: .78rem;
  color: var(--article-sub);
  border-top: 1px solid var(--article-border);
}

body.has-common-header .article-toc {
  top: 47px;
  height: calc(100vh - 47px);
}

@media (max-width: 860px) {
  .article-wrapper {
    display: block;
  }

  .article-toc,
  body.has-common-header .article-toc {
    position: relative;
    top: auto;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--article-border);
  }

  .article-main {
    padding: 24px 18px 60px;
  }
}
