@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

/* ===== グローバルリセット ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== ライトモード（デフォルト） ===== */
:root {
  --bg-color: #f9fafb;
  --text-color: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --primary-color: #3b82f6; /* 青色 */
  --hover-color: #007BFF;   /* 青色 */
}

/* ===== ダークモード ===== */
/* バグ修正: @media の {} が抜けていた・margin/padding/box-sizing は :root に書けない */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #111827;
    --text-color: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: #374151;
  }
}

/* ===== ベース ===== */
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--hover-color);
}

/* ===== レイアウト ===== */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== ヘッダー ===== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-color);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  flex-wrap: wrap;
}

/* ===== メインコンテンツ ===== */
.site-main {
  flex-grow: 1;
  padding: 3rem 0;
}

/* ===== Welcome Section ===== */
.welcome-section {
  text-align: center;
  margin-bottom: 4rem;
  padding: 3rem 0;
}

.welcome-title {
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.welcome-text {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== セクションタイトル ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary-color);
  padding-left: 0.75rem;
}

/* ===== 記事グリッド ===== */
.posts-grid {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
}

/* ===== 記事カード ===== */
.post-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-color);
}

.post-category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.post-title {
  font-size: 1.125rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

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

.post-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ===== About セクション ===== */
.about-section p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.8;
}

.about-table {
  width: 100%;
  margin-top: 2rem;
  border-collapse: collapse;
}

.about-table th,
.about-table td {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.about-table th {
  font-weight: 800;
  width: 30%;
  color: var(--primary-color);
  white-space: nowrap;
}

/* モバイルではテーブルをスタック表示 */
@media (max-width: 480px) {
  .about-table,
  .about-table tbody,
  .about-table tr,
  .about-table th,
  .about-table td {
    display: block;
    width: 100%;
  }

  .about-table th {
    padding-bottom: 0.25rem;
    border-bottom: none;
  }

  .about-table td {
    padding-top: 0.25rem;
  }
}

/* ===== 記事ページ ===== */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-title-full {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  line-height: 1.3;
  margin: 0.5rem 0 1rem;
}

.post-body {
  font-size: 1rem;
  line-height: 1.9;
  max-width: 680px;
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-section-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 2.5rem 0 1rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--primary-color);
}

/* 強調したい一文に使うクラス（旧 .bigger） */
.post-highlight {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary-color);
  margin: 1.25rem 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.875rem;
}

/* ===== 記事内画像 ===== */
.post-images {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.post-img {
  height: 180px;
  width: auto;
  max-width: 100%;
  border-radius: 0.375rem;
  display: block;
}

@media (max-width: 480px) {
  .post-img {
    height: 120px;
  }
}

.post-subsection-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 2rem 0 0.75rem;
  color: var(--text-color);
}

.post-list {
  padding-left: 1.5rem;
  margin: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.post-list li {
  font-size: 0.95rem;
  line-height: 1.6;
}

.post-body code {
  font-family: monospace;
  font-size: 0.9em;
  background-color: var(--border-color);
  padding: 0.1em 0.4em;
  border-radius: 0.25rem;
}

/* ===== ライトボックス ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 0.5rem;
  cursor: default;
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

/* ===== フッター ===== */
.site-footer {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* ===== コードブロック ===== */

.post-body pre {
    position: relative;
    margin: 1.5em 0;
    padding: 3em 1.2em 1.2em;

    overflow-x: auto;
    white-space: pre;

    background: #1e1e1e;
    color: #d4d4d4;

    border: 1px solid #333;
    border-radius: 7px;

    font-family:
        ui-monospace,
        SFMono-Regular,
        "SF Mono",
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        "Courier New",
        monospace;

    font-size: 0.9em;
    line-height: 1.55;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);

    -webkit-overflow-scrolling: touch;
}

/* code本体 */
.post-body pre code {
    padding: 0;
    margin: 0;

    background: transparent;
    color: inherit;

    border: 0;
    border-radius: 0;

    font: inherit;
}

/* コードブロック上部バー */
.code-copy-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 2.1em;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    padding: 0 0.55em;

    background: #252525;
    border-bottom: 1px solid #3a3a3a;

    border-radius: 7px 7px 0 0;
}

/* コピー */
.code-copy-button {
    border: 0;
    background: transparent;

    color: #b8b8b8;

    padding: 0.25em 0.65em;
    border-radius: 4px;

    font-size: 0.82em;
    font-family: inherit;

    cursor: pointer;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.code-copy-button:hover {
    background: #3a3a3a;
    color: #ffffff;
}

.code-copy-button.copied {
    color: #7ee787;
}

