:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #1976d2;
  --brand-strong: #0d47a1;
  --border: #e5e7eb;
  --shadow: 0 6px 24px rgba(2, 6, 23, 0.08);
}

html { scroll-behavior: smooth; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}

/* dark theme removed */

/* ヘッダー */
header {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(8px);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  border-bottom: 1px solid var(--border);
}
header .nav {
  display:flex; align-items:center; justify-content:space-between;
  gap: 1.2rem; padding: 0.6rem 1.2rem; max-width: 1100px; margin: 0 auto;
}
header .brand { display:flex; align-items:center; gap: .65rem; color: var(--brand); font-weight: 800; font-size: 1.25rem; text-decoration: none; }
header .brand img { height: 44px; width: 44px; border-radius: 8px; }
header .links a { color: var(--brand); font-weight: 600; text-decoration: none; padding: .4rem .6rem; border-radius: 6px; }
header .links a:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
header .tools { display:flex; align-items:center; gap:.5rem; }
header .tool-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: .35rem .6rem; border-radius: 8px; }

/* Responsive nav */
.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: .35rem .6rem;
  border-radius: 8px;
}

@media (max-width: 700px) {
  header .nav { gap: .6rem; }
  .menu-toggle { display: inline-flex; align-items:center; justify-content:center; }
  header .links { position: absolute; top: 56px; right: 12px; background: var(--card); border:1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: .4rem; display: none; }
  header .links a { display:block; padding: .5rem .8rem; }
  header .links.open { display: block; }
}

/* Header shrink on scroll */
header.shrink .brand img { height: 36px; width: 36px; transition: height .15s, width .15s; }
header.shrink .brand span { font-size: 1.1rem; transition: font-size .15s; }

/* レイアウト */
.layout { display:flex; max-width:1100px; margin:2rem auto; gap:2rem; }
.sidebar { width:260px; background: var(--card); border:1px solid var(--border); border-radius: 14px; padding: 1.2rem; box-shadow: var(--shadow); height: fit-content; }
.sidebar h2 { color: var(--brand); font-size: 1.05rem; margin: 0 0 .6rem; padding-bottom: .4rem; border-bottom: 1px dashed var(--border); }
.sidebar a { color: var(--text); }
main { flex:1; background: var(--card); padding: 1.6rem; border-radius: 14px; border:1px solid var(--border); box-shadow: var(--shadow); }

/* Profile card */
.profile-card { border:1px solid var(--border); background: color-mix(in srgb, var(--card) 96%, transparent); border-radius: 12px; padding: 0.9rem; margin-bottom: 1rem; }
.profile-row { display:flex; gap:.8rem; align-items: center; }
.profile-avatar { width:56px; height:56px; border-radius: 50%; object-fit: cover; border:1px solid var(--border); }
.profile-name { font-weight: 700; color: var(--brand); }
.profile-bio { color: var(--muted); font-size: .92em; margin-top:.2rem; }
.profile-links { display:flex; gap:.6rem; margin-top:.4rem; }
.profile-links a { font-size: .85em; color: var(--brand); border:1px solid var(--border); padding:.15rem .5rem; border-radius: 999px; background: #f8fafc; }

/* カード（チェキ風投稿） */
/* チェキ風投稿レイアウト */
.post-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2em;
}
.cheki-post {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1em 1em 0.7em 1em;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1em;
}

.cheki-post:hover {
  box-shadow: 0 14px 40px rgba(17,117,218,0.18);
  transform: translateY(-4px) scale(1.02);
}
.cheki-img-frame {
  background: color-mix(in srgb, var(--brand) 5%, #fff);
  border: 4px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 1em;
}
.cheki-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.cheki-img-placeholder {
  background: #e0e0e0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cheki-title {
  margin-top: 0.5em;
  font-size: 1.1em;
  font-weight: bold;
  color: var(--brand);
  text-align: center;
  word-break: break-all;
}
.cheki-excerpt {
  margin-top: 0.3em;
  color: var(--muted);
  font-size: 0.95em;
  text-align: center;
  min-height: 2.2em;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .post-grid {
    grid-template-columns: 1fr;
    gap: 1em;
  }
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5em 0;
}

.sidebar li {
  margin-bottom: 0.7em;
}


/* 投稿詳細の本文内の画像は領域内で自動縮小 */
.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.post-content {
  line-height: 1.8;
}

/* 目次スタイル */
.post-toc {
  background: #f7fbff;
  border: 1px solid #e3f2fd;
  padding: 1em;
  border-radius: 8px;
  margin: 1em 0 1.5em;
}
.post-toc ul { margin: 0.5em 0 0; padding-left: 1em; }
.post-toc li { margin: 0.3em 0; }
.post-toc .toc-l2 { margin-left: 0; }
.post-toc .toc-l3 { margin-left: 1em; font-size: 0.95em; }
.post-toc a { color: #1976d2; }

/* 記事本文の見出しを少し強調 */
.post-content h1, .post-content h2, .post-content h3 {
  border-bottom: 1px solid #eef2f7;
  padding-bottom: 0.2em;
  margin-top: 1.2em;
}
.post-content strong, .post-content b { font-weight: 700; }

/* 修正: リンクと見出しのスタイル分離 */
body, main {
  color: var(--text);
}

/* リンクのスタイル */
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  color: var(--brand-strong);
}

/* 見出しのスタイル */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
}

button, input[type="submit"] {
  background: var(--brand);
  color: #fff;
  border: 1px solid var(--brand);
  padding: 0.55em 1.1em;
  border-radius: 10px;
  font-size: 0.95em;
  cursor: pointer;
  margin-top: 0.5em;
  transition: background 0.2s, color 0.2s, transform 0.08s;
}
button:hover, input[type="submit"]:hover { background: transparent; color: var(--brand); }
button:active, input[type="submit"]:active { transform: translateY(1px); }

ul {
  list-style: none;
  padding: 0;
}
li {
  margin-bottom: 1em;
  padding: 0.5em;
  background: #f7f7f7;
  border-radius: 5px;
}

h1, h2 {
  color: #1976d2;
  margin-top: 0;
}

form label {
  display: block;
  margin: 1em 0 0.5em;
}

textarea, input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.5em;
  border-radius: 5px;
  border: 1px solid var(--border);
  margin-bottom: 1em;
  background: color-mix(in srgb, var(--card) 96%, transparent);
  color: var(--text);
}

/* 検索フォームの高さを統一 */
input[type="text"], button {
  font-size: 1rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  box-sizing: border-box;
  height: 2.5rem;
}

input[type="text"] {
  margin: 0 0 16px;
}

button[type="submit"] {
  margin: 0 0 16px;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    gap: 1em;
  }
  .sidebar {
    width: 100%;
    margin-bottom: 1em;
  }
  main {
    padding: 1em;
  }
}

/* ヒーローセクション */
.hero-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 4rem 1rem;
  background: url('/img/hero.jpg') center/cover no-repeat;
  border-radius: 12px;
  margin-bottom: 2rem;
  position: relative; /* overlay 用 */
  overflow: hidden;
}
/* 背景が明るくても文字が読めるよう暗いオーバーレイを敷く */
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  border-radius: inherit;
  pointer-events: none;
}
.hero-section h1,
.hero-section p {
  position: relative; /* overlay の上に出す */
  z-index: 1;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
@media (max-width: 700px) {
  .hero-section::before { background: rgba(0,0,0,0.45); }
}

/* 検索セクション */
.search-section form {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.search-section input {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 60%;
  max-width: 400px;
}
.search-section button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.search-section button:hover {
  background: var(--brand-strong);
}

/* 注目記事セクション */
.featured-section h2 {
  font-size: 1.5rem;
  color: var(--brand);
  margin-bottom: 1rem;
}

/* カテゴリセクション */
.category-section ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.category-section li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
}
.category-section a {
  text-decoration: none;
  color: var(--text);
}
.category-section a:hover {
  color: var(--brand);
}

/* 最新ニュースセクション */
.news-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}
.news-section h2 {
  font-size: 1.5rem;
  color: var(--brand);
  margin-bottom: 1rem;
}

/* Utilities */
.to-top-btn { position: fixed; right: 20px; bottom: 22px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* contact page */
.form-card { background: var(--card); border:1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 1.2rem; }
.row { display:grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 700px){ .row { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: .9em; }

/* admin markdown preview */
.md-preview { display: none; border:1px solid var(--border); padding: .8rem; border-radius:8px; background: color-mix(in srgb, var(--card) 96%, transparent); max-height: 60vh; overflow:auto; }