/* ========================================
   SAP入門ナレッジ - Modern Responsive CSS
   ======================================== */

/* CSS Variables */
:root {
  --primary: #0066cc;
  --primary-dark: #004fa3;
  --primary-light: #3389dd;
  --primary-gradient: #0066cc;
  --secondary: #f0f6ff;
  --background: #ffffff;
  --foreground: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --card-shadow-hover: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --transition: 0.15s ease;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: clip;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Helvetica Neue', sans-serif;
  line-height: 1.7;
  color: var(--foreground);
  background-color: var(--background);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100vw;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; color: var(--muted); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

ul { list-style: none; }

/* ========================================
   Layout
   ======================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 3rem 0;
}

/* ========================================
   Header
   ======================================== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo a {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.logo a:hover { color: var(--primary-dark); }

nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex-wrap: wrap;
}

nav ul li a {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--primary);
  background-color: var(--secondary);
  text-decoration: none;
}

/* Hamburger Menu */
#menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
  transition: all var(--transition);
}

#menu-toggle:hover {
  background: var(--secondary);
  border-color: var(--primary);
}

#menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--foreground);
  border-radius: 2px;
  transition: all var(--transition);
}

#menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#menu-toggle.open span:nth-child(2) { opacity: 0; }
#menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ========================================
   Hero Section
   ======================================== */
.hero {
  padding: 7rem 0 6rem;
  background: linear-gradient(160deg, #f0f6ff 0%, #ffffff 60%, #f8faff 100%);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(0,102,204,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 50%;
  height: 150%;
  background: radial-gradient(ellipse, rgba(0,170,255,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: var(--secondary);
  color: var(--primary);
  border: 1px solid rgba(0,102,204,0.2);
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  color: var(--foreground);
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.hero .highlight {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--muted);
  margin-bottom: 2.5rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--secondary);
  border-color: var(--primary);
  text-decoration: none;
  color: var(--primary);
}

.btn-large {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

/* ========================================
   Section Titles
   ======================================== */
.section-title {
  text-align: center;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--muted);
  margin-bottom: 3rem;
  font-size: 1.05rem;
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

.card-description {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.card-header { margin-bottom: 1rem; }
.card-content p { font-size: 0.95rem; }

/* ========================================
   Grid
   ======================================== */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ========================================
   CTA Banner
   ======================================== */
.cta-banner {
  background: var(--primary-gradient);
  color: white;
  text-align: center;
  padding: 5rem 0;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.cta-banner .container { position: relative; z-index: 1; }

.cta-banner h2 {
  color: white;
  margin-bottom: 1rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

.cta-banner p {
  color: rgba(255,255,255,0.85);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.cta-banner .btn {
  background: white;
  color: var(--primary);
  border-color: white;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.cta-banner .btn:hover {
  background: rgba(255,255,255,0.92);
  color: var(--primary);
}

/* ========================================
   Footer
   ======================================== */
footer {
  background: var(--foreground);
  color: rgba(255,255,255,0.85);
  padding: 3rem 0 0;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.footer-section h4 {
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.footer-section p {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-section ul { list-style: none; }
.footer-section ul li { margin-bottom: 0.6rem; }
.footer-section ul li a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color var(--transition);
}
.footer-section ul li a:hover { color: white; text-decoration: none; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 1.25rem 1.5rem;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-bottom p {
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  margin: 0;
}

/* ========================================
   Blog
   ======================================== */
.blog-post { cursor: pointer; }

/* Blog Scroll Carousel */
.blog-scroll-wrapper {
  padding: 0.5rem 0 1.5rem;
  overflow: hidden;
}

.blog-scroll-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
}

@media (max-width: 768px) {
  .blog-scroll-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    padding: 0.5rem 0 1.5rem;
  }

  .blog-scroll-wrapper::-webkit-scrollbar {
    display: none;
  }

  .blog-scroll-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    width: max-content;
  }

  .blog-scroll-card {
    width: 78vw;
    max-width: 320px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

.filter-btn {
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: transparent;
}

/* ========================================
   Article Content
   ======================================== */
article {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--foreground);
}

/* 読了プログレスバー */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--primary);
  z-index: 9999;
  transition: width 0.1s linear;
}

article h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  color: var(--foreground);
  scroll-margin-top: 5rem;
}

article h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--foreground);
  scroll-margin-top: 5rem;
}

article p { color: var(--foreground); }

article ul, article ol {
  margin: 1rem 0 1.5rem 1.75rem;
  list-style: disc;
}

article ol { list-style: decimal; }
article li { margin-bottom: 0.4rem; color: var(--foreground); }

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border);
}

article table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.9rem;
}

article th {
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  word-break: break-word;
  overflow-wrap: break-word;
}

article td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--foreground);
  word-break: break-word;
  overflow-wrap: break-word;
}

article tr:hover td { background: var(--border-light); }

article code {
  background: var(--border-light);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--primary-dark);
}

article pre {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

article pre code {
  background: none;
  color: #e2e8f0;
  padding: 0;
  font-size: 0.875rem;
}

article blockquote {
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.copy-btn {
  display: block;
  margin-left: auto;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: var(--secondary);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.copy-btn:hover { background: var(--primary); color: white; }

/* (旧TOCスタイルは toc-sidebar / toc-inline に移行済み) */

/* ========================================
   Forms
   ======================================== */
.form-group { margin-bottom: 1.5rem; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--foreground);
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

/* ========================================
   Module Card Links
   ======================================== */
.module-card-link {
  text-decoration: none;
  display: block;
}

.module-card-link .card-title {
  transition: color var(--transition);
}

.module-card-link:hover .card {
  border-color: var(--primary);
  box-shadow: var(--card-shadow-hover);
}

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

.module-card-arrow {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

/* ========================================
   Page Hero (non-home pages)
   ======================================== */
.page-hero {
  background-color: #f9fafb;
  padding: 2.5rem 0;
}

.page-hero-desc {
  color: var(--muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* Article Meta (single page) */
.article-meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.reading-time-badge {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--border-light);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.article-meta-dates {
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
}

.article-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

@media (max-width: 768px) {
  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* Content wrapper */
.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

/* ========================================
   Blog 2-Column Layout
   ======================================== */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: start;
}

.blog-main {
  min-width: 0;
}

/* ========================================
   Sidebar
   ======================================== */
.sidebar {
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-widget {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
}

.sidebar-widget-title {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
}

.sidebar-category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-size: 0.9rem;
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar-category-link:hover {
  background: var(--secondary);
  color: var(--primary);
}

.sidebar-category-count {
  font-size: 0.75rem;
  background: var(--secondary);
  color: var(--primary);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ========================================
   Sidebar Profile
   ======================================== */
.sidebar-profile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-profile-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-light);
  margin-bottom: 0.75rem;
}

.sidebar-profile-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--foreground);
}

.sidebar-profile-role {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
  margin-bottom: 0.75rem;
}

.sidebar-profile-bio {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--foreground);
  margin: 0 0 1rem;
  text-align: left;
}

.sidebar-profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.sidebar-profile-btn {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all var(--transition);
}

.sidebar-profile-btn-primary {
  background: #0053F4;
  color: #fff;
}

.sidebar-profile-btn-primary:hover {
  background: #003fc0;
}

.sidebar-profile-btn-secondary {
  background: var(--secondary);
  color: var(--primary);
  border: 1px solid var(--border);
}

.sidebar-profile-btn-secondary:hover {
  background: #f0f6ff;
}

/* ========================================
   Tag Cloud
   ======================================== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-cloud-item {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--secondary);
  color: var(--primary);
  border-radius: 4px;
  border: 1px solid rgba(0,102,204,0.15);
  text-decoration: none;
  transition: all var(--transition);
}

.tag-cloud-item:hover {
  background: var(--primary);
  color: white;
}

/* ========================================
   Search Box
   ======================================== */
.search-input-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.65rem 2.5rem 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--foreground);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.search-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

.search-results {
  margin-top: 0.5rem;
  border-radius: var(--radius-sm);
  overflow-y: auto;
  max-height: 60vh;
  background: var(--background);
}

.search-result-summary {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.15rem 0 0.2rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-item mark,
.search-result-title mark,
.search-result-summary mark {
  background: #fff3a0;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

.search-result-item {
  display: block;
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  background: var(--background);
  border: 1px solid var(--border);
  border-top: none;
  transition: background var(--transition);
}

.search-result-item:first-child {
  border-top: 1px solid var(--border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.search-result-item:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.search-result-item:hover {
  background: var(--secondary);
}

.search-result-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.15rem;
}

.search-result-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.search-no-results {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.5rem;
  text-align: center;
}

/* ========================================
   Filter Select (Dropdown)
   ======================================== */
.filter-select-wrap {
  position: relative;
}

.filter-select {
  width: 100%;
  padding: 0.65rem 2rem 0.65rem 0.9rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--foreground);
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

.filter-select optgroup {
  font-weight: 700;
  color: var(--muted);
}

.filter-select option {
  font-weight: 400;
  color: var(--foreground);
  padding: 0.25rem;
}

/* ========================================
   Active Filter Bar
   ======================================== */
.active-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--secondary);
  border: 1px solid rgba(0,102,204,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
}

.clear-filter-btn {
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}

.clear-filter-btn:hover {
  background: var(--primary);
  color: white;
}

/* ========================================
   Blog Card Styles (Updated)
   ======================================== */
.blog-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.blog-card-date {
  font-size: 0.8rem;
  color: var(--muted);
}

.blog-card-title a {
  color: var(--foreground);
  text-decoration: none;
  transition: color var(--transition);
}

.blog-card-title a:hover {
  color: var(--primary);
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.blog-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.blog-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--secondary);
  color: var(--primary);
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid rgba(0,102,204,0.15);
  transition: all var(--transition);
}

.blog-tag:hover {
  background: var(--primary);
  color: white;
}

.read-more-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition);
}

.read-more-link:hover {
  color: var(--primary-dark);
}

/* ========================================
   Category Badges (Color-coded)
   ======================================== */
.category-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: white;
  background: var(--primary);
}

.category-badge-学習ガイド { background: #0066cc; }
.category-badge-導入事例 { background: #059669; }
.category-badge-技術解説 { background: #7c3aed; }

/* ========================================
   No Results
   ======================================== */
.no-results-message {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

/* ========================================
   ToC - Sidebar (PC: 追従目次)
   ======================================== */
.toc-sidebar {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.toc-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.toc-sidebar-list {
  list-style: none;
  border-left: 2px solid var(--border);
  max-height: calc(100vh - 12rem);
  overflow-y: auto;
  overflow-x: hidden;
}

.toc-sidebar-list::-webkit-scrollbar {
  width: 3px;
}
.toc-sidebar-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.toc-sidebar-list li {
  margin: 0;
  display: block;
  width: 100%;
}

.toc-sidebar-list a {
  display: block;
  padding: 0.4rem 0.75rem 0.4rem 1rem;
  margin-left: -2px;
  border-left: 3px solid transparent;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  text-decoration: none;
  border-radius: 0 4px 4px 0;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
  word-break: break-word;
  overflow-wrap: break-word;
}

.toc-sidebar-list a:hover {
  color: var(--foreground);
  background: var(--border-light);
}

.toc-sidebar-list a.toc-active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
  background: var(--secondary);
}

.toc-sidebar-list .toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-left: 1rem;
}

.toc-sidebar-list .toc-h3 a {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem 0.25rem 1rem;
}

/* ========================================
   ToC - Inline (モバイル: 冒頭目次)
   ======================================== */
.toc-inline {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  display: none;
}

.toc-inline-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.75rem;
}

.toc-inline ul {
  list-style: none;
}

.toc-inline li {
  margin-bottom: 0.4rem;
}

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

.toc-inline a:hover {
  color: var(--primary);
}

/* ========================================
   ToC - Floating Button (モバイル: フローティング)
   ======================================== */
.toc-fab {
  display: none;
  position: fixed;
  bottom: 4.75rem;
  right: 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(0,102,204,0.3);
  cursor: pointer;
  z-index: 900;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s, box-shadow 0.2s;
}

.toc-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,102,204,0.4);
}

.toc-fab.visible {
  display: flex;
}

/* モバイル目次パネル */
.toc-mobile-panel {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 60vh;
  background: var(--background);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1);
  z-index: 1000;
  flex-direction: column;
  padding: 0;
}

.toc-mobile-panel.open {
  display: flex;
  animation: tocSlideUp 0.25s ease-out;
}

@keyframes tocSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* スワイプハンドル（つまみ） */
.toc-mobile-handle {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
  cursor: grab;
  touch-action: none;
}

.toc-mobile-handle-bar {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.toc-mobile-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin: 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.toc-mobile-panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
}

.toc-mobile-panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.5rem 2rem;
  -webkit-overflow-scrolling: touch;
}

.toc-mobile-panel ul {
  list-style: none;
}

.toc-mobile-panel li {
  margin-bottom: 0.25rem;
}

.toc-mobile-panel a {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
}

.toc-mobile-panel a:hover,
.toc-mobile-panel a.toc-active {
  color: var(--primary);
}

.toc-mobile-panel .toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.8rem;
}

.toc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}

.toc-overlay.open {
  display: block;
}

/* ========================================
   Series Navigation (Step Bar)
   ======================================== */
.series-nav {
  margin-bottom: 2rem;
  padding: 1.25rem 1rem;
  background: var(--secondary);
  border-radius: 12px;
  overflow-x: auto;
}

.series-heading {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.75rem 0;
}

.series-steps {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
}

.series-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.series-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

a.series-dot:hover {
  border-color: var(--primary);
  background: var(--secondary);
}

.series-step.is-done .series-dot {
  border-color: var(--primary);
  background: var(--primary);
}

.series-step.is-done .series-dot::after {
  content: "✓";
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

.series-step.is-current .series-dot {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15);
  width: 32px;
  height: 32px;
  cursor: default;
}

.series-step.is-current .series-dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
}

.series-step-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

a.series-step-label:hover {
  color: var(--primary);
}

.series-step.is-current .series-step-label {
  color: var(--primary);
  font-weight: 600;
}

.series-step.is-done .series-step-label {
  color: var(--foreground);
}

.series-connector {
  height: 2px;
  flex: 1;
  min-width: 20px;
  background: var(--border);
  margin-top: 14px;
  align-self: flex-start;
}

.series-connector.is-done {
  background: var(--primary);
}

/* Parallel series (grid layout, no connectors) */
.series-nav.series-parallel {
  overflow-x: visible;
}

.series-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  min-width: 0;
}

.series-grid .series-step {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  transition: border-color 0.2s ease;
}

.series-grid .series-step:hover {
  border-color: var(--primary);
}

.series-grid .series-step.is-current {
  border-color: var(--primary);
  background: rgba(0, 102, 204, 0.06);
}

.series-grid .series-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border: 2px solid var(--border);
}

.series-grid .series-step.is-current .series-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: none;
}

.series-grid .series-step.is-current .series-dot::after {
  display: none;
}

.series-grid .series-step-label {
  max-width: none;
  -webkit-line-clamp: unset;
  font-size: 0.75rem;
}

.series-grid .series-step.is-current .series-step-label {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 768px) {
  .series-nav {
    padding: 1rem 0.75rem;
  }
  .series-step-label {
    font-size: 0.65rem;
    max-width: 60px;
  }
  .series-grid {
    flex-direction: column;
    gap: 0.5rem;
  }
  .series-grid .series-step {
    width: 100%;
    min-width: 0;
  }
  .series-grid .series-step-label {
    font-size: 0.75rem;
    max-width: none;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
}

/* ========================================
   Post Navigation
   ======================================== */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.post-nav-link {
  color: var(--primary);
  font-size: 0.9rem;
  max-width: 45%;
  transition: color var(--transition);
}

.post-nav-link:hover { color: var(--primary-dark); }
.post-nav-next { text-align: right; margin-left: auto; }

/* ========================================
   Blog Inline Search（サイドバー非表示時に記事一覧上部へ）
   ======================================== */
.blog-inline-search {
  display: none;
  padding: 1rem;
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.inline-category-quick {
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.inline-category-quick .filter-group-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.inline-category-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0;
  margin: 0;
}

.inline-category-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--foreground);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.inline-category-count {
  font-size: 0.75rem;
  background: var(--secondary);
  color: var(--primary);
  padding: 0.1rem 0.55rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ========================================
   Grid 1 Column
   ======================================== */
.grid-1 {
  display: grid;
  grid-template-columns: 1fr;
}

/* ========================================
   Post List (Qiita style)
   ======================================== */
.post-list {
  border-top: 1px solid var(--border);
  margin-bottom: 2rem;
}

.post-list-item {
  padding: 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: none;
  box-shadow: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  transition: background var(--transition);
}

.post-list-item:hover {
  background: var(--border-light);
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.post-list-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.post-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.post-list-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}

.post-list-title a {
  color: var(--foreground);
  text-decoration: none;
  transition: color var(--transition);
}

.post-list-title a:hover {
  color: var(--primary);
}

.post-list-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.post-list-author {
  font-weight: 500;
  color: var(--muted);
}

.post-list-date {
  color: var(--muted-light);
}

/* ========================================
   Responsive Overflow Fixes
   ======================================== */

/* テキストオーバーフロー防止 */
article,
.card,
.post-list-item,
.sidebar-widget {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 画像・動画の最大幅制限 */
article img,
article video,
article iframe {
  max-width: 100%;
  height: auto;
}

/* テーブルのスクロール（article外も含む） */
.content-wrapper table,
.card table {
  width: 100%;
  table-layout: fixed;
}

/* ========================================
   Post List Item — Full Card Clickable
   ======================================== */
.post-list-item {
  position: relative;
}

.post-list-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.post-list-tags .blog-tag,
.post-list-foot a {
  position: relative;
  z-index: 1;
}

/* ========================================
   Homepage Layout (Content + Sidebar)
   ======================================== */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
}

.home-main {
  min-width: 0;
}

.home-sidebar {
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* 最新記事リスト */
.recent-posts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.recent-post-item {
  border-bottom: 1px solid var(--border-light);
}

.recent-post-item:last-child {
  border-bottom: none;
}

.recent-post-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.25rem;
  text-decoration: none;
  transition: background var(--transition);
  border-radius: var(--radius-sm);
}

.recent-post-link:hover {
  background: var(--secondary);
  padding-left: 0.5rem;
}

.recent-post-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: break-word;
  transition: color var(--transition);
}

.recent-post-link:hover .recent-post-title {
  color: var(--primary);
}

.recent-post-date {
  font-size: 0.75rem;
  color: var(--muted-light);
}

.sidebar-more-link {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  text-align: right;
  transition: color var(--transition);
}

.sidebar-more-link:hover {
  color: var(--primary-dark);
}

/* 広告プレースホルダー */
.sidebar-ad-placeholder {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-placeholder {
  width: 100%;
  min-height: 100px;
  background: var(--border-light);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-light);
  font-size: 0.8rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-content { grid-template-columns: 1fr 1fr; }
  .blog-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .blog-inline-search {
    display: block;
  }
  .home-layout {
    grid-template-columns: 1fr;
  }
  .home-sidebar {
    position: static;
  }
  .toc-inline {
    display: block;
  }
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  section { padding: 3.5rem 0; }

  #menu-toggle { display: flex; }

  #nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    padding: 0.75rem 1rem;
    z-index: 999;
  }

  #nav-menu.open { display: block; }

  #nav-menu ul {
    flex-direction: column;
    gap: 0;
  }

  #nav-menu ul li a {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  .hero { padding: 4rem 0 3rem; }
  .hero-buttons { flex-direction: column; align-items: center; }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  article table { font-size: 0.8rem; }
  article th, article td { padding: 0.5rem 0.75rem; }

/* ========================================
   Mermaid ダイアグラム
   ======================================== */
.mermaid-wrapper {
  margin: 1.5rem 0;
  overflow-x: auto;
  text-align: center;
  position: relative;
  background:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center,
    linear-gradient(to right, rgba(255,255,255,0), #fff 70%) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.12), rgba(0,0,0,0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.12), rgba(0,0,0,0)) right center;
  background-repeat: no-repeat;
  background-size: 30px 100%, 30px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}

.mermaid-wrapper pre.mermaid {
  display: inline-block;
  background: none !important;
  color: inherit !important;
  padding: 0;
  margin: 0;
  font-size: 1rem;
}

.mermaid-wrapper pre.mermaid code {
  background: none !important;
  color: inherit !important;
}


  /* フィルターバーのwrap */
  .active-filter-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* ポストナビゲーション縦並び */
  .post-nav {
    flex-direction: column;
    gap: 0.75rem;
  }
  .post-nav-link {
    max-width: 100%;
  }

  /* ヒーローセクションのpadding調整 */
  .page-hero {
    padding: 1.75rem 0;
  }

  /* サイドバーのタグクラウド折り返し */
  .tag-cloud {
    gap: 0.3rem;
  }

  /* ブログカードフッターの縦並び */
  .blog-card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* ポストリストのpaddingを縮小 */
  .post-list-item {
    padding: 1rem 0.25rem;
  }

  /* 検索結果のz-index確保 */
  .search-results {
    position: relative;
    z-index: 10;
  }

  .home-sidebar {
    display: none;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 1rem; }
  .card { padding: 1.25rem; }
  .btn-large { width: 100%; }

  /* セクションのpadding縮小 */
  section { padding: 2.5rem 0; }

  /* ヒーローのpadding縮小 */
  .hero { padding: 2.5rem 0 2rem; }

  /* フッターグリッドの調整 */
  .footer-content { padding: 0 1rem 2rem; }

  /* ポストリストfootは横並び維持 */
  .post-list-foot {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
  }

  /* ブログタグのサイズ縮小 */
  .blog-tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
  }

  /* カテゴリバッジのサイズ縮小 */
  .category-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
  }
}

/* ========================================
   ページネーション
   ======================================== */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin: 2rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.7rem;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.pagination-btn:hover {
  background: var(--primary-dark, #1a56db);
}

.pagination-btn--edge {
  background: var(--muted, #6b7280);
}

.pagination-btn--edge:hover {
  background: #4b5563;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text, #1f2937);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.pagination-num:hover {
  background: var(--bg-alt, #f3f4f6);
}

.pagination-num--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination-ellipsis {
  padding: 0 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 640px) {
  .pagination {
    gap: 0.2rem;
  }
  .pagination-btn {
    padding: 0.3rem 0.45rem;
    font-size: 0.7rem;
  }
  .pagination-btn--edge {
    padding: 0.3rem 0.4rem;
  }
  .pagination-num {
    min-width: 1.6rem;
    padding: 0.25rem 0.3rem;
    font-size: 0.7rem;
  }
  .pagination-pages {
    gap: 0.15rem;
  }
  .pagination-ellipsis {
    font-size: 0.7rem;
    padding: 0 0.1rem;
  }
}

/* ========================================
   フィルターチップ
   ======================================== */
.filter-chips-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.filter-group-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--muted);
  background: var(--background);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.5;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--secondary);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ========================================
   モバイルフィルタートグル
   ======================================== */
.inline-filter-toggle-wrap {
  margin-top: 0.75rem;
}

.inline-filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--primary);
  background: var(--secondary);
  border: 1.5px solid rgba(0,102,204,0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  justify-content: center;
}

.inline-filter-toggle-btn:hover {
  background: rgba(0,102,204,0.12);
}

.filter-active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
}

.inline-filter-panel {
  padding: 0.75rem 0 0.25rem;
}

/* ========================================
   シェアボタン
   ======================================== */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.share-label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.share-links {
  display: flex;
  gap: 0.5rem;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: #fff;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.share-btn:hover {
  opacity: 0.8;
}

.share-btn-x {
  background: #000;
}

.share-btn-hatena {
  background: #00a4de;
}

.share-btn-line {
  background: #06c755;
}

/* ========================================
   関連記事 (Qiita風)
   ======================================== */
.related-posts {
  margin: 3rem 0 2rem;
  padding: 1.75rem 1.5rem;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.related-posts-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--foreground);
}

.related-posts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.related-posts-item {
  border-bottom: 1px solid var(--border);
}

.related-posts-item:last-child {
  border-bottom: none;
}

.related-posts-link {
  display: block;
  padding: 1rem 1rem;
  text-decoration: none;
  color: var(--foreground);
  transition: background 0.15s;
}

.related-posts-link:hover {
  background: #f0f6ff;
}

.related-posts-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.related-posts-link:hover .related-posts-item-title {
  color: var(--primary);
}

.related-posts-item-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.related-posts-cat {
  background: var(--secondary);
  color: var(--primary);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

/* ========================================
   トップへ戻るボタン
   ======================================== */
.back-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
  z-index: 500;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: #003fc0;
}

/* ========================================
   ナビ ドロップダウン
   ======================================== */
.has-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.nav-dropdown-toggle.active {
  color: var(--primary);
}

.nav-dropdown-caret {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.2s;
  display: inline-block;
  transform: rotate(90deg);
}

.has-dropdown.open .nav-dropdown-caret {
  transform: rotate(-90deg);
}

.nav-drilldown-back {
  display: none;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.4rem 0;
  z-index: 100;
}

.has-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu li {
  list-style: none;
}

.nav-dropdown-menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.nav-dropdown-menu a:hover {
  background: var(--secondary);
  color: var(--primary);
}

.nav-dropdown-all {
  font-weight: 700;
  color: var(--primary) !important;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.25rem;
}

.nav-dropdown-count {
  font-size: 0.72rem;
  background: var(--secondary);
  color: var(--primary);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
}

@media (max-width: 768px) {
  /* モバイル: ドリルダウン式スライドイン（フルスクリーンoverlay） */
  .has-dropdown {
    position: static;
  }
  .has-dropdown .nav-dropdown-menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin: 0;
    padding: 1rem;
    transform: translateX(100%);
    transition: transform 0.28s ease;
    will-change: transform;
    z-index: 1000;
    overflow-y: auto;
  }
  #nav-menu.drilled .has-dropdown .nav-dropdown-menu {
    transform: translateX(0);
  }
  .nav-drilldown-back {
    display: block;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0.25rem;
  }
  .nav-drilldown-back-btn {
    background: none;
    border: none;
    font: inherit;
    color: var(--primary);
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    text-align: left;
    min-height: 44px;
  }
  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    min-height: 44px;
    font-size: 1rem;
  }
  .nav-dropdown-menu a {
    padding: 0.85rem 1rem;
    font-size: 1rem;
    min-height: 44px;
  }
}

/* ========================================
   アクセシビリティ: フォーカス表示の強化
   ======================================== */
:focus-visible {
  outline: 3px solid #0053F4;
  outline-offset: 2px;
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.filter-chip:focus-visible,
.pagination-btn:focus-visible,
.pagination-num:focus-visible,
.copy-btn:focus-visible {
  outline: 3px solid #0053F4;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(0, 83, 244, 0.25);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 83, 244, 0.35);
}

/* ========================================
   モバイル: タップ領域の拡大（≤768px）
   ======================================== */
@media (max-width: 768px) {
  .btn {
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    min-height: 44px;
  }

  .filter-chip {
    padding: 0.55rem 0.95rem;
    font-size: 0.85rem;
    min-height: 38px;
  }

  .copy-btn {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    min-height: 40px;
  }

  .inline-filter-toggle-btn {
    min-height: 44px;
  }

  .sidebar-profile-btn {
    padding: 0.85rem 1rem;
    min-height: 44px;
    font-size: 0.9rem;
  }

  .inline-category-link {
    padding: 0.85rem 0.9rem;
    min-height: 48px;
    font-size: 0.92rem;
  }
}

@media (max-width: 640px) {
  .pagination-btn {
    padding: 0.7rem 0.7rem;
    font-size: 0.8rem;
    min-height: 40px;
  }
  .pagination-btn--edge {
    padding: 0.7rem 0.6rem;
  }
  .pagination-num {
    min-width: 2.4rem;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    min-height: 40px;
  }
}
