/* NgwTechBlog — self-contained stylesheet (no external fonts/CDN).
   Theme: Cerulean — 明るい青空基準のライトテーマ。 */

:root {
  --bg: #f9fdff;          /* faint sky tint */
  --surface: #ffffff;
  --text: #253440;
  --muted: #6b8395;
  --border: #e6f1f9;
  --accent: #56b4ea;      /* cerulean, softened */
  --accent-strong: #3ca2df;
  --accent-deep: #2b83bd; /* medium blue for headings (paler than before) */
  --accent-soft: #f0f8fe; /* very light blue chip / quote bg */
  --link: #2a8cc9;
  --code-bg: #eff6fc;
  --code-text: #2277b3;
  --pre-bg: #14324a;      /* softened navy for contrast */
  --pre-text: #e9f2fa;
  --sky-1: #eef7fe;
  --sky-2: #ffffff;
  --shadow: 0 1px 2px rgba(20, 70, 110, .04), 0 8px 24px rgba(20, 90, 140, .05);
  --shadow-head: 0 2px 10px rgba(70, 150, 210, .18);
  --radius: 14px;
  --wrap: 62rem;        /* wide (header/footer/index); reading pages use .wrap--narrow */
  --wrap-narrow: 46rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic",
    "Yu Gothic", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.85;
  font-size: 16.5px;
  letter-spacing: .01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }
.wrap--narrow { max-width: var(--wrap-narrow); }

/* ---- home: post list + right tag sidebar ---- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.4rem; align-items: start; }
.home-main { min-width: 0; }
.tag-sidebar { position: sticky; top: 74px; align-self: start; }
.tag-sidebar-inner {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow); padding: 1rem 1.05rem 1.15rem;
  max-height: calc(100vh - 96px); overflow-y: auto;
}
.tag-sidebar-title { margin: 0 0 .75rem; font-size: .74rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.tag-sidebar .tag-cloud-wrap { padding: 0; gap: .5rem; }
.tag-sidebar a.tag.tag-cloud { font-size: .8rem; padding: .24rem .6rem; }
.tag-sidebar-all { display: inline-block; margin-top: 1rem; font-size: .82rem; }
@media (max-width: 820px) {
  .home-grid { grid-template-columns: 1fr; }
  .tag-sidebar { display: none; }
}

/* ---- header ---- */
.site-head {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(120deg, #74c2ef 0%, #4faee4 55%, #329bd7 100%);
  box-shadow: var(--shadow-head);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; font-weight: 700; letter-spacing: .02em; font-size: 1.1rem; color: #fff; text-shadow: 0 1px 2px rgba(12, 70, 115, .3); }
.brand-logo { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 1px 2px rgba(12, 70, 115, .35)); }
.brand-mark { color: #eefaff; }
.brand-rest { color: #ffffff; }
.site-head nav { display: flex; gap: 1.15rem; align-items: center; }
.site-head nav a { color: #fff; text-decoration: none; font-size: .9rem; white-space: nowrap; transition: opacity .12s ease; text-shadow: 0 1px 2px rgba(12, 70, 115, .28); opacity: .95; }
.site-head nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 460px) { .site-head nav { gap: .75rem; } .site-head nav a { font-size: .82rem; } }

/* hamburger menu (mobile): brand stays left, nav collapses */
.nav-toggle { position: absolute; left: -9999px; opacity: 0; }
.nav-burger { display: none; }
@media (max-width: 640px) {
  .site-head .wrap { position: relative; }
  .brand { white-space: nowrap; }
  .nav-burger {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 40px; height: 40px; padding: 10px 8px; margin-right: -8px; cursor: pointer;
    border-radius: 8px; color: #fff;
  }
  .nav-burger span { display: block; width: 100%; height: 2px; background: currentColor; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  .site-head nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #329bd7; border-top: 1px solid rgba(255, 255, 255, .28);
    box-shadow: var(--shadow-head); padding: .3rem 0;
  }
  .nav-toggle:checked ~ nav { display: flex; }
  .site-head nav a { padding: .85rem 1.25rem; font-size: .95rem; }
  .site-head nav a:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---- footer ---- */
.site-foot { margin-top: 5rem; border-top: 1px solid var(--border); padding: 2.5rem 0; background: linear-gradient(180deg, transparent, var(--sky-1)); }
.site-foot p { margin: .2rem 0; }
.site-foot .muted { color: var(--muted); font-size: .88rem; }
.site-foot a { color: var(--link); }
.site-foot .ai-note { margin-top: .9rem; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.site-foot .ai-note::before { content: "🤖"; font-size: .95rem; }

/* ---- home: "AIとの対話の記録である" badge (top-left) ---- */
.ai-badge {
  display: inline-flex; align-items: baseline; gap: .5rem;
  margin: 1.4rem 0 0; padding: .42rem .9rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow);
  text-decoration: none; transition: border-color .15s ease, transform .15s ease;
}
.ai-badge::before { content: "🤖"; font-size: .9rem; }
.ai-badge:hover { border-color: var(--accent); transform: translateY(-1px); }
.ai-badge-eyebrow { font-size: .7rem; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.ai-badge-title { font-size: .86rem; font-weight: 800; color: var(--accent-deep); }
@media (max-width: 460px) { .ai-badge-eyebrow { display: none; } }

/* ---- hero + index ---- */
.hero {
  padding: 3.5rem 1.5rem 2.4rem;
  margin: 1.5rem 0 2.5rem;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--sky-1) 0%, var(--sky-2) 75%);
  border: 1px solid var(--border);
  text-align: center;
}
.hero h1 { font-size: 2.2rem; margin: 0 0 .5rem; letter-spacing: .01em; color: var(--accent-deep); }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 22px rgba(20, 110, 170, .14); }
.card-link { display: block; padding: 1.4rem 1.5rem .85rem; text-decoration: none; color: inherit; }
.card .tags { padding: 0 1.5rem 1.35rem; margin-top: .25rem; }
.card h2 { margin: .35rem 0 .5rem; font-size: 1.28rem; line-height: 1.5; color: var(--accent-deep); }
.card:hover h2 { color: var(--accent-strong); }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card-meta, .meta { color: var(--muted); font-size: .82rem; display: flex; gap: .5rem; align-items: center; }
.dot { opacity: .5; }

/* ---- tags ---- */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.tag { font-size: .74rem; color: var(--accent-deep); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); padding: .12rem .55rem; border-radius: 999px; }
a.tag { text-decoration: none; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
a.tag:hover { background: color-mix(in srgb, var(--accent) 20%, #fff); border-color: var(--accent); }
.tag.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- tag filter banner (index) ---- */
.filter-banner { display: flex; align-items: center; gap: .5rem; margin: 0 0 1.6rem; padding: .55rem .9rem; background: var(--accent-soft); border: 1px solid var(--border); border-radius: 10px; font-size: .9rem; color: var(--text); flex-wrap: wrap; }
.filter-banner[hidden] { display: none; }
.filter-banner .filter-count { color: var(--muted); font-size: .82rem; }
.filter-clear { margin-left: auto; color: var(--link); text-decoration: none; font-size: .85rem; white-space: nowrap; }
.filter-clear:hover { text-decoration: underline; }

/* ---- search toolbar ---- */
.toolbar { display: flex; align-items: center; gap: .8rem; margin: 0 0 1.4rem; flex-wrap: wrap; }
.search-box {
  flex: 1 1 16rem; min-width: 0;
  font: inherit; font-size: .95rem;
  padding: .55rem .9rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
.search-box::placeholder { color: var(--muted); }
.search-box:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.sort-toggle { font: inherit; font-size: .85rem; cursor: pointer; color: var(--accent-deep); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .5rem .95rem; white-space: nowrap; transition: border-color .12s ease, background .12s ease, color .12s ease; }
.sort-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.sort-toggle[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tags-link { color: var(--link); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.tags-link:hover { text-decoration: underline; }
.no-results { text-align: center; color: var(--muted); padding: 2rem 0; }
.no-results[hidden] { display: none; }

/* ---- tag cloud (tags/index.html) ---- */
.tag-cloud-wrap { display: flex; flex-wrap: wrap; gap: .7rem; padding: .5rem 0 1rem; }
a.tag.tag-cloud { font-size: .95rem; padding: .35rem .8rem; display: inline-flex; align-items: center; gap: .45rem; }
.tag-cloud .tag-count { font-size: .72rem; background: color-mix(in srgb, var(--accent) 24%, #fff); color: var(--accent-deep); border-radius: 999px; padding: 0 .45rem; min-width: 1.2rem; text-align: center; }

/* ---- article ---- */
.article { padding-top: 2rem; }
.back { display: inline-block; margin-bottom: 1.5rem; color: var(--accent-strong); text-decoration: none; font-size: .9rem; }
.back:hover { text-decoration: underline; text-underline-offset: 3px; }
.post-head { border-bottom: 2px solid var(--accent-soft); padding-bottom: 1.6rem; margin-bottom: 2rem; }
.post-head h1 { font-size: 2rem; line-height: 1.4; margin: .6rem 0 .3rem; color: var(--accent-deep); }
.post-title .pt-main { display: block; }
.post-title .pt-sub { display: block; font-size: .62em; font-weight: 600; color: var(--muted); line-height: 1.5; margin-top: .5em; padding-left: 1.5em; }
.post-head .lead { color: var(--muted); font-size: 1.05rem; margin: .6rem 0 0; }

/* ---- post prev/next nav ---- */
.post-nav { display: flex; gap: 1rem; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.post-nav > a, .post-nav > span { flex: 1 1 0; min-width: 0; }
.post-nav > span:empty { visibility: hidden; }
.post-nav a { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; padding: .9rem 1.1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease; }
.post-nav a:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.post-nav-next { text-align: right; align-items: flex-end; }
.pn-label { font-size: .78rem; color: var(--accent-strong); }
.pn-title { font-size: .95rem; color: var(--text); line-height: 1.45; }
@media (max-width: 560px) {
  .post-nav { flex-direction: column; }
  .post-nav-next { text-align: left; align-items: flex-start; }
  .post-nav > span:empty { display: none; }
}

/* ---- prose ---- */
.prose { font-size: 1.02rem; }
.prose h2 { font-size: 1.5rem; margin: 2.6rem 0 1rem; padding-top: .5rem; border-top: 1px solid var(--border); color: var(--accent-deep); }
.prose h2:first-child { border-top: 0; margin-top: 0; }
.prose h3 { font-size: 1.2rem; margin: 2rem 0 .8rem; color: var(--text); }
.prose h4 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; color: var(--accent-strong); }
.prose p { margin: 1.1rem 0; }
.prose a { color: var(--link); text-underline-offset: 2px; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 1.1rem 0; }
.prose li { margin: .4rem 0; }
.prose li::marker { color: var(--accent); }
.prose img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; margin: 1.4rem auto; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4rem 0; }

.prose blockquote {
  margin: 1.4rem 0; padding: .6rem 1.2rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; color: var(--text);
}
.prose blockquote p { margin: .5rem 0; }

/* 注意喚起の赤いコールアウト */
.prose .alert {
  margin: 1.4rem 0; padding: .8rem 1.2rem;
  border-left: 4px solid #c0392b;
  background: #fdf1ef; border-radius: 0 8px 8px 0;
  color: #7a231a;
}
.prose .alert strong { color: #b3271b; }

/* 出典・前提のお断り（落ち着いた注記） */
.prose .note {
  margin: 1.4rem 0; padding: .8rem 1.2rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0;
  color: var(--text); font-size: .95rem;
}
.prose .note strong { color: var(--accent-deep); }

/* inline code + code blocks */
.prose code { background: var(--code-bg); color: var(--code-text); padding: .12em .4em; border-radius: 6px; font-size: .9em; font-family: "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; }
.prose pre { background: var(--pre-bg); color: var(--pre-text); padding: 1.1rem 1.25rem; border-radius: 12px; overflow-x: auto; margin: 1.5rem 0; line-height: 1.6; box-shadow: var(--shadow); }
.prose pre code { background: none; color: inherit; padding: 0; font-size: .86rem; }

/* tables */
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .94rem; display: block; overflow-x: auto; }
.prose thead th { background: var(--accent-soft); text-align: left; color: var(--accent-deep); }
.prose th, .prose td { border: 1px solid var(--border); padding: .55rem .8rem; }
.prose tbody tr:nth-child(even) { background: #f4fafe; }

/* figure caption convention used in posts: <div class="cap">…</div> */
.prose .cap { text-align: center; color: var(--muted); font-size: .82rem; margin: -.8rem 0 1.6rem; }

/* image floated left, body text wraps on the right */
.prose .fig-left { float: left; width: min(300px, 44%); margin: .3rem 1.6rem .8rem 0; }
.prose .fig-left img { width: 100%; margin: 0; }
.prose .fig-left .cap { text-align: left; margin: .5rem 0 0; }
.prose h2 { clear: both; }  /* section headings start below any floated figure */
@media (max-width: 640px) {
  .prose .fig-left { float: none; width: 100%; margin: 1.4rem auto; }
  .prose .fig-left .cap { text-align: center; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding: 2.6rem 1.1rem 2rem; }
  .hero h1 { font-size: 1.75rem; }
  .post-head h1 { font-size: 1.55rem; }
}

/* article layout: left AI-disclosure rail + reading column */
.article-layout { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 2.6rem; align-items: start; }
.article-col { min-width: 0; }
.ai-rail { position: sticky; top: 74px; align-self: start; }
.ai-rail-inner {
  border: 1px solid var(--accent); border-left: 4px solid var(--accent);
  background: var(--accent-soft); border-radius: 12px; padding: 1rem 1.05rem;
}
.ai-rail-eyebrow { margin: 0; font-size: .72rem; letter-spacing: .12em; font-weight: 700; color: var(--muted); }
.ai-rail-title { margin: .1rem 0 .55rem; font-size: 1.06rem; line-height: 1.35; font-weight: 800; color: var(--accent-deep); }
.ai-rail-note { margin: 0 0 .7rem; font-size: .78rem; line-height: 1.65; color: var(--text); }
.ai-rail-link { font-size: .8rem; font-weight: 700; color: var(--accent-strong); text-decoration: none; }
.ai-rail-link:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 820px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 1.3rem; }
  .ai-rail { position: static; }
  .ai-rail-inner { padding: .7rem .9rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; }
  .ai-rail-eyebrow { font-size: .7rem; }
  .ai-rail-title { margin: 0; font-size: .95rem; }
  .ai-rail-title br { display: none; }
  .ai-rail-note { display: none; }
  .ai-rail-link { margin-left: auto; }
}

/* series label ("文書管理特集#N") — kicker above the post title, and a chip on cards */
.post-series {
  display: inline-block; margin-bottom: .5rem;
  font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent-deep); background: var(--accent-soft);
  padding: .2rem .7rem; border-radius: 999px; text-decoration: none;
}
.post-series:hover { background: var(--accent); color: #fff; }
.card-series { color: var(--accent-deep); font-weight: 700; }
.post-no { color: var(--accent-deep); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* click-to-zoom: screenshots are readable at full size. hover shows a magnifier cursor. */
.prose img { cursor: zoom-in; transition: box-shadow .18s ease, transform .18s ease; }
.prose img:hover { box-shadow: 0 8px 26px rgba(20, 70, 110, .22); transform: translateY(-2px) scale(1.006); }

.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center; padding: 2.2vmin;
  background: rgba(8, 20, 32, .86); cursor: zoom-out;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .16s ease;
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox img {
  max-width: 96vw; max-height: 92vh; width: auto; height: auto;
  margin: 0; border: 0; border-radius: 8px; background: #fff; cursor: zoom-out;
  box-shadow: 0 16px 60px rgba(0, 0, 0, .55);
}
.lightbox .lb-cap {
  position: fixed; left: 0; right: 0; bottom: 1.6vh; margin: 0 auto; max-width: 60rem;
  text-align: center; color: #e8f1f8; font-size: .84rem; line-height: 1.5;
  padding: 0 4vw; text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.lightbox .lb-close {
  position: fixed; top: 1vh; right: 2.4vw; color: #fff; font-size: 2.2rem; line-height: 1;
  cursor: pointer; opacity: .8; border: 0; background: none; padding: .2rem .5rem;
}
.lightbox .lb-close:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .prose img, .lightbox { transition: none; }
  .prose img:hover { transform: none; }
}
