/* =====================================================================
   自由IT同盟 — Article page
   ===================================================================== */

/* reading progress */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--brand); z-index: 100; transition: width .1s linear; }

/* ===== reference links (公式ドキュメント) ===== */
.refbox { margin: 22px 0 26px; border: 1px solid var(--note-line); background: var(--note-soft); border-radius: 13px; padding: 15px 16px 16px; }
.refbox .rb-head { display: flex; align-items: center; gap: 8px; font-family: var(--head); font-weight: 700; font-size: 12.5px; letter-spacing: .02em; color: var(--note); margin-bottom: 4px; }
.refbox .rb-head svg { width: 17px; height: 17px; }
.reflink { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; margin-top: 9px; }
.reflink:hover { border-color: var(--note-line); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.reflink .rl-ic { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; color: var(--note); background: color-mix(in oklch, var(--note) 11%, white); border: 1px solid color-mix(in oklch, var(--note) 22%, white); }
.reflink .rl-ic svg { width: 17px; height: 17px; }
.reflink .rl-main { min-width: 0; flex: 1; }
.reflink .rl-t { font-size: 13.5px; font-weight: 700; font-family: var(--head); line-height: 1.45; color: var(--ink); }
.reflink:hover .rl-t { color: var(--note); }
.reflink .rl-u { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.reflink .ja-badge { font-family: var(--head); font-weight: 700; font-size: 10px; color: var(--tip); background: var(--tip-soft); border: 1px solid var(--tip-line); border-radius: 5px; padding: 1px 6px; letter-spacing: .04em; }
.reflink .rl-go { color: var(--ink-3); flex-shrink: 0; display: grid; place-items: center; }
.reflink:hover .rl-go { color: var(--note); }
.reflink .rl-go svg { width: 15px; height: 15px; }

/* breadcrumb */
.crumb { font-size: 12.5px; color: var(--ink-3); padding: 18px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--mono); }
.crumb a:hover { color: var(--brand-ink); }
.crumb .sep { opacity: .5; }

/* article header */
.art-head { padding: 22px 0 26px; border-bottom: 1px solid var(--line); }
.art-head .top-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.art-head h1 { font-size: 34px; font-weight: 900; line-height: 1.42; letter-spacing: .01em; max-width: 20em; }
.art-lead { font-size: 16px; color: var(--ink-2); margin: 18px 0 0; line-height: 1.9; max-width: 42em; }
.art-meta { display: flex; align-items: center; gap: 22px; margin-top: 24px; flex-wrap: wrap; }
.author { display: flex; align-items: center; gap: 11px; }
.author .ava { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,var(--c-entra),var(--c-azure)); display:grid; place-items:center; color:#fff; font-family:var(--head); font-weight:900; font-size:15px; }
.author .who b { font-size: 13.5px; font-weight: 700; display: block; }
.author .who span { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.art-meta .sep-v { width: 1px; height: 30px; background: var(--line); }
.metaset { display: flex; flex-direction: column; gap: 3px; }
.metaset .k { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.metaset .v { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 7px; }

/* hero figure */
.art-hero { aspect-ratio: 21/9; border-radius: 16px; overflow: hidden; margin: 28px 0 0; }

/* 2-col reading layout */
.art-layout { display: grid; grid-template-columns: 1fr 250px; gap: 52px; align-items: start; padding: 40px 0 0; }
/* TOC column must span the full row height so position:sticky has scroll room */
.art-layout > aside { align-self: stretch; }

/* ===== content typography ===== */
.prose { font-size: 16px; color: var(--ink); max-width: 46em; min-width: 0; }
.prose > * { scroll-margin-top: 84px; }
.prose h2 {
  font-size: 25px; font-weight: 900; margin: 52px 0 18px; padding-top: 8px;
  display: flex; align-items: center; gap: 13px; line-height: 1.4;
}
.prose h2 .num {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 15px;
}
.prose h3 { font-size: 19px; font-weight: 700; margin: 38px 0 14px; padding-left: 14px; border-left: 4px solid var(--brand-line); }
.prose p { margin: 0 0 18px; line-height: 1.95; }
.prose a.link { color: var(--brand-ink); font-weight: 500; border-bottom: 1px solid var(--brand-line); }
.prose a.link:hover { background: var(--brand-soft); }
.prose strong { font-weight: 700; }
.prose mark { background: color-mix(in oklch, var(--c-sec) 22%, white); padding: 1px 4px; border-radius: 4px; font-weight: 500; }
.prose blockquote { margin: 20px 0; padding: 4px 18px; border-left: 4px solid var(--brand-line); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--ink-2); }
.prose blockquote p { margin: 10px 0; font-size: 14.5px; line-height: 1.85; }
.prose blockquote strong { color: var(--ink); }
.prose blockquote a.link { word-break: break-all; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 0; list-style: none; }
.prose ul li, .prose ol li { position: relative; padding-left: 28px; margin-bottom: 11px; line-height: 1.85; }
.prose ul li::before { content: ""; position: absolute; left: 8px; top: 12px; width: 7px; height: 7px; border-radius: 2px; background: var(--brand); transform: rotate(45deg); }
/* nested lists: lighter marker, tighter rhythm */
.prose ul ul { margin: 9px 0 4px; }
.prose ul ul li { padding-left: 22px; margin-bottom: 7px; font-size: 0.95em; color: var(--ink-2); }
.prose ul ul li::before { content: ""; top: 11px; left: 4px; width: 8px; height: 2px; border-radius: 2px; background: var(--ink-3); transform: none; }
.prose ol { counter-reset: li; }
.prose ol li::before { counter-increment: li; content: counter(li); position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-family: var(--mono); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.prose code:not(pre code) { font-family: var(--mono); font-size: 0.86em; background: var(--surface-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--brand-ink); font-weight: 500; }
.kbd { font-family: var(--mono); font-size: 0.82em; background: var(--surface); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; box-shadow: var(--shadow-sm); }

/* lead-in box */
.intro-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin: 0 0 8px; box-shadow: var(--shadow-sm);
}
.intro-box .ib-label { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--brand-ink); margin-bottom: 10px; }
.intro-box ul { margin: 0; }
.intro-box ul li { margin-bottom: 8px; font-size: 14.5px; color: var(--ink-2); }

/* ===== callouts (labeled tab + tinted panel; no cliché) ===== */
.callout { border-radius: 12px; padding: 18px 20px 18px 20px; margin: 24px 0; border: 1px solid var(--cl-line); background: var(--cl-soft); position: relative; }
.callout .cl-head { display: flex; align-items: center; gap: 9px; font-family: var(--head); font-weight: 700; font-size: 13.5px; color: var(--cl-ink); margin-bottom: 8px; }
.callout .cl-head svg { width: 18px; height: 18px; }
.callout .cl-icon { width: 26px; height: 26px; border-radius: 8px; background: var(--cl-ink); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.callout .cl-icon svg { width: 16px; height: 16px; }
.callout p:last-child { margin-bottom: 0; }
.callout p, .callout li { font-size: 14.5px; line-height: 1.85; }
.callout.warn   { --cl-line: var(--warn-line);  --cl-soft: var(--warn-soft);  --cl-ink: var(--warn); }
.callout.tip    { --cl-line: var(--tip-line);   --cl-soft: var(--tip-soft);   --cl-ink: var(--tip); }
.callout.note   { --cl-line: var(--note-line);  --cl-soft: var(--note-soft);  --cl-ink: var(--note); }
.callout.danger { --cl-line: var(--danger-line);--cl-soft: var(--danger-soft);--cl-ink: var(--danger); }

/* ===== step UI ===== */
.steps { margin: 28px 0; position: relative; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 20px; padding-bottom: 28px; position: relative; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 21px; top: 44px; bottom: -4px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-num {
  width: 44px; height: 44px; border-radius: 13px; z-index: 1;
  background: var(--surface); border: 2px solid var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-family: var(--head); font-weight: 900; font-size: 18px;
  box-shadow: 0 0 0 4px var(--bg);
}
.step-body { padding-top: 4px; }
.step-body h4 { font-size: 17px; font-weight: 700; margin-bottom: 8px; font-family: var(--head); }
.step-body p { margin: 0 0 12px; font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.step-shot { border-radius: 11px; overflow: hidden; border: 1px solid var(--line); margin: 12px 0; }
.step-shot.ph { aspect-ratio: 16/8; }

/* ===== code block ===== */
.code { margin: 24px 0; border-radius: 12px; overflow: hidden; border: 1px solid oklch(0.32 0.015 255); box-shadow: var(--shadow); }
.code-head { display: flex; align-items: center; gap: 10px; background: oklch(0.27 0.015 255); padding: 9px 14px; }
.code-head .dots { display: flex; gap: 6px; }
.code-head .dots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.code-head .fname { font-family: var(--mono); font-size: 12px; color: oklch(0.78 0.01 255); margin-left: 4px; }
.code-head .lang { margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: oklch(0.62 0.02 255); }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; background: oklch(0.34 0.015 255); color: oklch(0.82 0.01 255); border: 0; border-radius: 7px; padding: 5px 10px; font-size: 11.5px; font-family: var(--mono); transition: background .15s; }
.copy-btn:hover { background: oklch(0.40 0.015 255); }
.copy-btn.copied { background: var(--tip); color: #fff; }
.copy-btn svg { width: 13px; height: 13px; }
.code pre { margin: 0; background: oklch(0.21 0.015 255); padding: 18px 18px; overflow-x: auto; }
.code code { font-family: var(--mono); font-size: 13px; line-height: 1.75; color: oklch(0.88 0.01 255); }
.code .cmt { color: oklch(0.58 0.02 255); }
.code .kw  { color: oklch(0.74 0.12 300); }
.code .fn  { color: oklch(0.78 0.11 230); }
.code .str { color: oklch(0.78 0.11 140); }
.code .var { color: oklch(0.82 0.10 60); }
.code .num { color: oklch(0.78 0.12 30); }

/* ===== diagram (flow) ===== */
.figure { margin: 28px 0; }
.figure figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 11px; text-align: center; font-family: var(--mono); }
.diagram { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 30px 24px; }
.flow { display: flex; align-items: stretch; justify-content: center; gap: 0; flex-wrap: wrap; }
.flow-node {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px 18px; min-width: 130px; text-align: center; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center;
}
.flow-node .fn-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.flow-node .fn-ico svg { width: 18px; height: 18px; }
.flow-node b { font-size: 13.5px; font-family: var(--head); }
.flow-node small { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.flow-node.accent { border-color: var(--brand-line); background: var(--brand-soft); }
.flow-arrow { display: grid; place-items: center; padding: 0 6px; color: var(--ink-3); }
.flow-arrow svg { width: 26px; height: 26px; }
.flow-branch { display: flex; flex-direction: column; gap: 10px; }
.flow-branch .flow-node { min-width: 150px; }
.branch-label { font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 5px; align-self: center; }

/* ===== comparison table ===== */
.tbl-wrap { margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cmp th { background: var(--surface-3); text-align: left; padding: 13px 16px; font-family: var(--head); font-weight: 700; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--line); }
table.cmp td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: top; }
table.cmp tr:last-child td { border-bottom: 0; }
table.cmp tbody tr:hover { background: var(--surface-2); }
table.cmp td:first-child, table.cmp th:first-child { font-weight: 700; color: var(--ink); font-family: var(--head); }
.yes { color: var(--tip); font-weight: 700; }
.no { color: var(--danger); font-weight: 700; }

/* divider */
.hr-dot { display: block; height: 1.5px; border: none; background: linear-gradient(to right, transparent, var(--line) 20%, var(--line) 80%, transparent); margin: 44px 0; }
.hr-dot i { display: none; }

/* ===== TOC sidebar ===== */
.toc-wrap { position: sticky; top: 90px; }
.toc { border-left: 2px solid var(--line); padding-left: 0; }
.toc .toc-title { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--ink-3); padding-left: 18px; margin-bottom: 12px; }
.toc a { display: block; font-size: 13px; color: var(--ink-3); padding: 7px 0 7px 18px; line-height: 1.5; border-left: 2px solid transparent; margin-left: -2px; transition: color .15s, border-color .15s; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--brand-ink); border-left-color: var(--brand); font-weight: 700; }
.toc a.sub { padding-left: 30px; font-size: 12.5px; }

.toc-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 9px; }
.toc-act { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; font-family: var(--head); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px; transition: all .15s; width: 100%; text-align: left; cursor: pointer; }
.toc-act:hover { border-color: var(--brand-line); color: var(--brand-ink); background: var(--brand-soft); }
.toc-act svg { width: 16px; height: 16px; }
.toc-act.active { color: var(--acc-ink); background: var(--acc-soft); border-color: var(--acc-line); }
.toc-act.active svg { fill: currentColor; }

/* ===== toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 14px);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 11px 20px; border-radius: 100px; box-shadow: var(--shadow-lg); z-index: 120;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* tags + share footer of article */
.art-foot { max-width: 46em; margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--line); }
.art-foot .tags { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 28px; }
.feedback { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.feedback b { font-size: 15px; font-family: var(--head); }
.feedback .fb-btns { display: flex; gap: 10px; }
.fb-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 18px; font-size: 13.5px; font-weight: 700; font-family: var(--head); transition: all .15s; }
.fb-btn:hover { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand-ink); }
.fb-btn.sel { background: var(--brand); color: #fff; border-color: var(--brand); }

/* author bio */
.bio { display: flex; gap: 18px; margin-top: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; align-items: flex-start; }
.bio .ava { width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg,var(--c-entra),var(--c-azure)); display:grid; place-items:center; color:#fff; font-family:var(--head); font-weight:900; font-size:20px; }
.bio b { font-size: 15px; font-family: var(--head); }
.bio .role { font-size: 12px; color: var(--ink-3); font-family: var(--mono); margin: 2px 0 9px; }
.bio p { font-size: 13.5px; color: var(--ink-2); line-height: 1.8; margin: 0; }

/* related */
.related { margin-top: 60px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ===== floating back-to-top ===== */
.backtop {
  position: fixed; right: 26px; bottom: 26px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--acc); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 20px color-mix(in oklch, var(--acc) 40%, transparent), var(--shadow);
  opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none;
  transition: opacity .22s, transform .22s, background .15s;
}
.backtop.show { opacity: 1; transform: none; pointer-events: auto; }
.backtop:hover { background: var(--acc-ink); transform: translateY(-2px); }
.backtop:active { transform: translateY(0); }
.backtop svg { width: 20px; height: 20px; }

@media (max-width: 980px) {
  .art-layout { grid-template-columns: 1fr; gap: 0; }
  .toc-wrap { display: none; }
  .art-head h1 { font-size: 28px; }
  .rel-grid { grid-template-columns: 1fr; }
  .flow { flex-direction: column; align-items: center; }
  .flow-arrow svg { transform: rotate(90deg); }
}
@media (max-width: 600px) {
  .art-meta { gap: 14px; }
  .art-meta .sep-v { display: none; }
  .prose h2 { font-size: 21px; }
}
