/* ========================================
   何か作りたいエンジニアの奮闘記 - 共通スタイル
   Theme Color: Deep Blue (#1a4b8c / #1e5aa8)
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=M+PLUS+Rounded+1c:wght@400;700&display=swap');

:root {
  --primary:       #1a4b8c;
  --primary-dark:  #123570;
  --primary-light: #2d6cc0;
  --primary-bg:    #eef3fb;
  --primary-pale:  #f0f5ff;
  --accent:        #3a8fd1;
  --text:          #222;
  --text-sub:      #555;
  --text-muted:    #888;
  --border:        #d8e3ef;
  --bg:            #f4f6fb;
  --card-bg:       #fff;
  --radius:        8px;
  --radius-sm:     4px;
  --shadow:        0 2px 12px rgba(26,75,140,.08);
  --shadow-hover:  0 6px 24px rgba(26,75,140,.15);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.85;
}

a { color: var(--primary-light); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
code, pre { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace; }

/* ========== HEADER ========== */
#header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  box-shadow: 0 2px 10px rgba(26,75,140,.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-title-wrap { padding: 16px 0; }
.site-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.3;
}
.site-title a { color: #fff; text-decoration: none; }
.site-title a:hover { color: rgba(255,255,255,.85); text-decoration: none; }
.site-description { font-size: 12px; color: rgba(255,255,255,.7); }

/* ========== NAV ========== */
#nav { background: var(--primary-dark); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.nav-list { list-style: none; display: flex; }
.nav-list li a {
  display: block;
  padding: 10px 18px;
  font-size: 13px;
  color: rgba(255,255,255,.8);
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-bottom: 3px solid transparent;
}
.nav-list li a:hover,
.nav-list li.current a {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-bottom-color: rgba(255,255,255,.6);
  text-decoration: none;
}

/* ========== AD BANNER (header below nav) ========== */
.ad-header-wrap {
  background: #fff;
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 8px 0;
}
.ad-label {
  font-size: 10px;
  color: #bbb;
  display: block;
  margin-bottom: 3px;
  letter-spacing: .05em;
}

/* ========== LAYOUT ========== */
#content {
  max-width: 1100px;
  margin: 32px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}
#main { min-width: 0; }

/* ========== POST LIST ========== */
.post-list { list-style: none; }
.post-list-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .25s, transform .2s;
  box-shadow: var(--shadow);
}
.post-list-item:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.post-card-link { display: flex; text-decoration: none; color: inherit; }
.post-thumb { flex: 0 0 210px; position: relative; overflow: hidden; background: #dde4f0; }
.post-thumb img { width: 210px; height: 118px; object-fit: cover; transition: transform .35s; }
.post-list-item:hover .post-thumb img { transform: scale(1.06); }
.post-thumb-cats { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.cat-badge {
  background: rgba(26,75,140,.88);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.post-body {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
.post-title-h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 7px;
  line-height: 1.55;
  color: var(--text);
  transition: color .2s;
}
.post-list-item:hover .post-title-h2 { color: var(--primary); }
.post-excerpt {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.75;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-meta-line { font-size: 12px; color: var(--text-muted); }

/* ========== PAGINATION ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-size: 14px;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: all .2s;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.page-btn.current { background: var(--primary); color: #fff; border-color: var(--primary); pointer-events: none; }
.page-btn.disabled { color: #ccc; pointer-events: none; background: #f5f5f5; }

/* ========== ARTICLE ========== */
.article-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}
.article-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.article-cats { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.article-cat-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 12px;
  text-decoration: none;
  transition: background .2s;
}
.article-cat-badge:hover { background: var(--primary-dark); text-decoration: none; }

/* Share Buttons */
.share-buttons-top {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 500;
  color: #fff;
  transition: opacity .2s, transform .15s;
}
.share-btn:hover { opacity: .85; text-decoration: none; transform: translateY(-1px); }
.share-btn.x       { background: #000; }
.share-btn.fb      { background: #1877f2; }
.share-btn.hatena  { background: #00a4de; }
.share-btn.pocket  { background: #ef3f56; }
.share-btn.line    { background: #06c755; }

.article-date { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; display: flex; align-items: center; gap: 6px; }
.article-date::before { content: '📅'; font-size: 13px; }
.article-title { font-size: 26px; font-weight: 700; line-height: 1.45; margin-bottom: 24px; color: var(--text); }

/* Ad slot in article */
.ad-article-wrap {
  margin: 28px 0;
  text-align: center;
  padding: 12px;
  background: var(--primary-pale);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* TOC */
.toc-box {
  background: var(--primary-pale);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.toc-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--primary); }
.toc-box ol, .toc-box ul { padding-left: 20px; }
.toc-box li { font-size: 13px; margin-bottom: 5px; line-height: 1.65; }
.toc-box a { color: var(--primary-light); }
.toc-box a:hover { color: var(--primary); }
.toc-box ol ol, .toc-box ul ul { margin-top: 4px; }

/* Article Body */
.article-body { line-height: 1.9; }
.article-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 40px 0 16px;
  padding: 11px 18px;
  background: var(--primary-bg);
  border-left: 5px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--primary-dark);
}
.article-body h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 30px 0 12px;
  padding-bottom: 7px;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  position: relative;
}
.article-body h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--primary);
}
.article-body h4 { font-size: 15px; font-weight: 700; margin: 22px 0 10px; color: var(--text-sub); }
.article-body p { margin-bottom: 16px; }
.article-body a { color: var(--primary-light); }
.article-body a:hover { color: var(--primary); }
.article-body img {
  margin: 20px auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 3px 12px rgba(0,0,0,.12);
}
.article-body pre {
  background: #0d1117;
  color: #e6edf3;
  border-radius: var(--radius);
  padding: 22px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.65;
  border: 1px solid #30363d;
}
.article-body code {
  background: var(--primary-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: var(--primary-dark);
  border: 1px solid var(--border);
}
.article-body pre code { background: none; padding: 0; color: #e6edf3; border: none; }
.article-body ul, .article-body ol { padding-left: 26px; margin-bottom: 16px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { font-weight: 700; color: var(--primary-dark); }
.article-body blockquote {
  border-left: 4px solid var(--primary-light);
  background: var(--primary-pale);
  padding: 14px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-sub);
  font-style: italic;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.article-body th, .article-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.article-body th { background: var(--primary-bg); font-weight: 700; color: var(--primary-dark); }
.article-body tr:nth-child(even) td { background: #f9fbff; }

/* Affiliate banner area */
.affiliate-box {
  margin: 24px 0;
  padding: 16px;
  background: linear-gradient(135deg, #fffbf0, #fff8e8);
  border: 1px solid #f0d890;
  border-radius: var(--radius);
  text-align: center;
}
.affiliate-label { font-size: 10px; color: #b88a00; display: block; margin-bottom: 6px; letter-spacing: .05em; }

/* Tags */
.article-tags { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-badge {
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 14px;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: all .2s;
}
.tag-badge:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

/* Breadcrumb */
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary-light); }
.breadcrumb-sep { color: #ccc; }

/* Post Nav */
.post-nav { display: flex; justify-content: space-between; margin-top: 36px; gap: 16px; }
.post-nav-btn {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  box-shadow: var(--shadow);
}
.post-nav-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--primary);
}
.post-nav-label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 4px; }

/* ========== SIDEBAR ========== */
#sidebar { min-width: 0; }
.widget {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.widget-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  padding: 10px 16px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.widget-body { padding: 16px; }
.profile-img { width: 100%; border-radius: var(--radius-sm); margin-bottom: 12px; }
.profile-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.profile-name a { color: var(--primary); text-decoration: none; }
.profile-desc { font-size: 13px; color: var(--text-sub); }

/* Search */
.search-form { display: flex; }
.search-input {
  flex: 1;
  border: 1px solid var(--border);
  border-right: none;
  padding: 9px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  outline: none;
  font-family: inherit;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--primary); }
.search-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: inherit;
  transition: background .2s;
}
.search-btn:hover { background: var(--primary-dark); }

/* Sidebar lists */
.widget-post-list { list-style: none; }
.widget-post-list li { border-bottom: 1px solid #f0f0f0; padding: 8px 0; }
.widget-post-list li:first-child { padding-top: 0; }
.widget-post-list li:last-child { border-bottom: none; padding-bottom: 0; }
.widget-post-list a { font-size: 13px; color: var(--text); line-height: 1.55; text-decoration: none; transition: color .2s; }
.widget-post-list a:hover { color: var(--primary); }
.widget-link-list { list-style: none; }
.widget-link-list li { border-bottom: 1px solid #f0f0f0; }
.widget-link-list li:last-child { border-bottom: none; }
.widget-link-list a { display: block; padding: 8px 0; font-size: 13px; color: var(--text); text-decoration: none; transition: color .2s; }
.widget-link-list a::before { content: '›'; color: var(--primary-light); margin-right: 6px; }
.widget-link-list a:hover { color: var(--primary); }

/* Sidebar Ad widget */
.widget-ad { text-align: center; }

/* ========== FOOTER ========== */
#footer {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 36px 24px;
  margin-top: 48px;
  font-size: 13px;
}
#footer a { color: rgba(255,255,255,.8); text-decoration: none; transition: color .2s; }
#footer a:hover { color: #fff; }
.footer-links { margin-bottom: 12px; display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.footer-copy { color: rgba(255,255,255,.5); font-size: 12px; }

/* ========== PRIVACY / STATIC PAGES ========== */
.privacy-content h2 { font-size: 18px; font-weight: 700; margin: 30px 0 12px; color: var(--primary-dark); }
.privacy-content p { margin-bottom: 14px; font-size: 14px; color: var(--text-sub); }
.privacy-content ul { padding-left: 24px; margin-bottom: 14px; }
.privacy-content li { font-size: 14px; margin-bottom: 6px; color: var(--text-sub); }

/* ========== RESPONSIVE ========== */
@media (max-width: 820px) {
  #header { position: relative; }
  .header-inner { padding: 0 16px; }
  .site-title { font-size: 17px; }
  #content { grid-template-columns: 1fr; padding: 0 16px; margin: 20px auto; }
  .post-card-link { flex-direction: column; }
  .post-thumb { flex: none; width: 100%; }
  .post-thumb img { width: 100%; height: 200px; }
  .article-wrap { padding: 22px 18px; }
  .article-title { font-size: 21px; }
  .post-nav { flex-direction: column; }
  .nav-inner { padding: 0 16px; }
  .nav-list li a { padding: 10px 14px; font-size: 13px; }
}
@media (max-width: 480px) {
  .share-buttons-top { gap: 6px; }
  .share-btn { padding: 5px 10px; font-size: 11px; }
}
