/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; line-height: 1.15; }

/* ===== Base ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: #1e293b;
  background-color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Back to Index ===== */
.back-to-index {
  margin-bottom: 24px;
}
.back-to-index a {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s;
}
.back-to-index a:hover {
  color: #2563eb;
}

/* ===== Layout ===== */
.article-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

@media (max-width: 640px) {
  .article-body {
    padding: 24px 16px 60px;
  }
}

/* ===== Hero Image ===== */
.article-hero {
  margin: 0 0 1.5rem;
}
.article-hero img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* ===== Article Dates ===== */
.article-dates {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: 1.5rem;
}

/* ===== Typography ===== */
.article-body h1 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  color: #1e293b;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.article-body h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.article-body p {
  margin-bottom: 1.25rem;
  color: #334155;
}

.article-body strong {
  font-weight: 600;
  color: #0f172a;
}

.article-body em {
  font-style: italic;
}

/* ===== Links ===== */
.article-body a {
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: #93c5fd;
  text-underline-offset: 2px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.article-body a:hover {
  color: #1d4ed8;
  text-decoration-color: #1d4ed8;
}

/* ===== Images ===== */
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  display: block;
}

.article-body figure {
  margin: 1.5rem 0;
}

.article-body figcaption {
  font-size: 0.875rem;
  color: #64748b;
  text-align: center;
  margin-top: 0.5rem;
}

/* ===== Lists ===== */
.article-body ul,
.article-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

.article-body ul {
  list-style-type: disc;
}

.article-body ol {
  list-style-type: decimal;
}

.article-body li {
  margin-bottom: 0.375rem;
  color: #334155;
}

.article-body li > ul,
.article-body li > ol {
  margin-top: 0.375rem;
  margin-bottom: 0;
}

/* ===== Blockquote ===== */
.article-body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid #3b82f6;
  background-color: #f8fafc;
  border-radius: 0 8px 8px 0;
  color: #475569;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

/* ===== Table ===== */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  overflow-x: auto;
  display: block;
  border: 1px solid #e2e8f0;
}

@media (min-width: 641px) {
  .article-body table {
    display: table;
  }
}

.article-body thead th,
.article-body tbody tr:first-child th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #0f172a;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e1;
}

.article-body tbody td {
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  color: #334155;
}

.article-body tbody tr:hover {
  background-color: #f8fafc;
}

/* ===== Code ===== */
.article-body code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background-color: #f1f5f9;
  color: #be185d;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.article-body pre {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background-color: #1e293b;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.6;
}

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

/* ===== Horizontal Rule ===== */
.article-body hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 2.5rem 0;
}

/* ===== Definition List ===== */
.article-body dl {
  margin-bottom: 1.25rem;
}

.article-body dt {
  font-weight: 600;
  color: #0f172a;
  margin-top: 1rem;
}

.article-body dd {
  margin-left: 1.5rem;
  color: #334155;
}

/* ===== iframe (YouTube等) ===== */
.article-body iframe {
  max-width: 100%;
  margin: 1.5rem 0;
  border-radius: 8px;
}

/* ===== Author Footer ===== */
.author-footer-container {
  display: flex;
  align-items: flex-start;
  border-top: 2px solid #e0e0e0;
  padding: 25px;
  margin-top: 30px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.author-footer-image-wrapper {
  flex-shrink: 0;
  margin-right: 20px;
}

.article-body .author-footer-image {
  width: 100px;
  height: 100px;
  min-width: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ddd;
  display: inline-block;
  margin: 0;
}

.author-footer-info p {
  margin: 0 0 5px 0;
  color: #343a40;
  line-height: 1.5;
}

.author-footer-name {
  font-size: 1.3em;
  font-weight: bold;
  margin-bottom: 8px;
}

.author-footer-title,
.author-footer-organization {
  font-size: 1em;
  color: #555;
}

.author-footer-bio {
  font-size: 0.95em;
  color: #444;
}

.author-footer-links a {
  color: #2563eb;
  text-decoration: none;
  margin-right: 12px;
  font-size: 0.9em;
}

.author-footer-links a:hover {
  text-decoration: underline;
}

.author-footer-published-at {
  font-size: 0.9em;
  color: #777;
  margin-top: 10px;
}

.author-footer-name {
  cursor: pointer;
  transition: color 0.2s;
}
.author-footer-name:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* ===== Author Profile Modal ===== */
.author-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.author-modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  text-align: center;
}
.author-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
.author-modal-close:hover {
  color: #475569;
}
.author-modal-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #ddd;
  margin-bottom: 16px;
}
.author-modal-name {
  font-size: 1.5em;
  font-weight: bold;
  color: #1e293b;
  margin-bottom: 4px;
}
.author-modal-title {
  font-size: 1em;
  color: #475569;
  margin-bottom: 2px;
}
.author-modal-organization {
  font-size: 0.9em;
  color: #64748b;
}
.author-modal-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}
.author-modal-bio-label {
  font-size: 0.85em;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
  text-align: left;
}
.author-modal-bio {
  font-size: 0.95em;
  color: #475569;
  line-height: 1.8;
  white-space: pre-wrap;
  text-align: left;
}
.author-modal-links {
  text-align: left;
}
.author-modal-links a {
  display: block;
  color: #2563eb;
  text-decoration: none;
  font-size: 0.9em;
  margin-bottom: 6px;
}
.author-modal-links a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .author-footer-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .author-footer-image-wrapper {
    margin-right: 0;
    margin-bottom: 15px;
  }
  .author-modal {
    padding: 24px 16px;
  }
}
