/* ==========================================================================
   1. Layout Strategy - ページ全体の構成
   ========================================================================== */

/* 固定ヘッダー分の余白 */
body {
  padding-top: 80px;
}

/* 一覧ページ（ホーム、アーカイブ、検索）のメインエリア */
:is(.home, .archive, .search) .site-main {
  display: block;
  padding: 0; /* 余白は中身のコンテナで制御 */
}

/* 記事一覧のグリッドコンテナ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* 詳細ページ・プロフィールの共通幅コンテナ */
.single .site-main {
  display: block;
}

.single-article-container,
.post-navigation-minimal,
.related-posts,
.author-profile {
  max-width: 800px;
  margin-right: auto !important;
  margin-left: auto !important;
}

/* ==========================================================================
   2. Single Post Header - 記事ヘッダー
   ========================================================================== */

.single-article-container {
  padding: 12px 20px 12px;
}

.entry-header {
  margin-bottom: 40px;
  text-align: center;
}

/* メタ情報エリア（日付・カテゴリー・タグ） */
.entry-meta-top {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.entry-date {
  color: #ccc;
  font-size: 3rem;
  letter-spacing: 0.1em;
}

.entry-taxonomies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.entry-title {
  max-width: 900px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.4;
}

.entry-header .entry-title {
  margin-bottom: 40px;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

.entry-thumbnail {
  margin-bottom: 40px;
}

.entry-thumbnail img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ==========================================================================
   3. Taxonomy Badges - カテゴリー・タグ装飾
   ========================================================================== */

.category-link,
.tag-link {
  display: inline-block;
  padding: 4px 14px;
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  vertical-align: middle;
  transition: all 0.3s ease;
}

.category-link:hover,
.tag-link:hover {
  color: #fff !important;
  transform: translateY(-2px);
}

/* カテゴリー専用（メインカラー） */
.category-link {
  border-color: var(--color-main);
  background-color: rgba(var(--color-main-rgb), 0.1);
  color: var(--color-main);
}

.category-link:hover {
  background-color: var(--color-main);
  box-shadow: 0 4px 10px rgba(var(--color-main-rgb), 0.3);
}

/* タグ専用（グリーン系） */
.tag-link {
  margin-left: 5px;
  border-color: #2e7d32;
  background-color: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
}

.tag-link:hover {
  background-color: #2e7d32;
  box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3);
}

.tag-link::before {
  content: '#';
  margin-right: 3px;
  opacity: 0.7;
}

/* ==========================================================================
   4. Entry Content - 本文・見出し（釣りアイコン）
   ========================================================================== */

.entry-content {
  color: var(--color-text);
  font-size: 1.1rem;
  line-height: 1.9;
}

.entry-content p {
  margin-bottom: 2em;
  font-size: 16px;
}

/* --- 見出し共通設定 --- */
.entry-content :is(h2, h3, h4) {
  display: flex;
  align-items: flex-start; /* 改行時、アイコンを1行目の高さに固定 */
  color: #222;
  scroll-margin-top: 100px;
}

/* アイコン（擬似要素）の共通定義 */
.entry-content :is(h2, h3, h4)::before {
  content: "";
  flex-shrink: 0; /* アイコンが圧縮されるのを防ぐ */
  display: inline-block;
  background-color: var(--color-main);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
}

/* --- H2：釣り竿 --- */
.entry-content h2 {
  margin: 3em 0 1.5em;
  padding-bottom: 8px;
  border-bottom: 2px solid #eee;
  font-size: 1.5rem;
  font-weight: 800;
}

.entry-content h2::before {
  width: 28px;
  height: 28px;
  margin-right: 12px;
  margin-top: 0.1em; /* テキストとの高さ微調整 */
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 11h1"/><path d="M8 15a2 2 0 0 1-4 0V3a1 1 0 0 1 1-1h.5C14 2 20 9 20 18v4"/><circle cx="18" cy="18" r="2"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 11h1"/><path d="M8 15a2 2 0 0 1-4 0V3a1 1 0 0 1 1-1h.5C14 2 20 9 20 18v4"/><circle cx="18" cy="18" r="2"/></svg>');
}

/* --- H3：魚 --- */
.entry-content h3 {
  margin: 2.5em 0 1.2em;
  font-size: 1.25rem;
  font-weight: 700;
}

.entry-content h3::before {
  width: 22px;
  height: 22px;
  margin-right: 10px;
  margin-top: 0.2em; /* テキストとの高さ微調整 */
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 16s9-15 20-4C11 23 2 8 2 8"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 16s9-15 20-4C11 23 2 8 2 8"/></svg>');
}

/* --- H4：釣り針 --- */
.entry-content h4 {
  margin: 1.5em 0 1em;
  font-size: 1.1rem;
  font-weight: 700;
}

.entry-content h4::before {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  margin-top: 0.2em;
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m17.586 11.414-5.93 5.93a1 1 0 0 1-8-8l3.137-3.137a.707.707 0 0 1 1.207.5V10"/><path d="M20.414 8.586 22 7"/><circle cx="19" cy="10" r="2"/></svg>');
  mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m17.586 11.414-5.93 5.93a1 1 0 0 1-8-8l3.137-3.137a.707.707 0 0 1 1.207.5V10"/><path d="M20.414 8.586 22 7"/><circle cx="19" cy="10" r="2"/></svg>');
}

/* 固定ヘッダー対策（スマホ用） */
@media (max-width: 767px) {
  .entry-content h2,
  .entry-content h3 {
    scroll-margin-top: 120px;
  }
}

/* ==========================================================================
   5. TOC - 目次
   ========================================================================== */

.toc-container {
  margin-bottom: 40px;
  padding: 25px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fcfcfc;
}

.toc-title {
  margin-bottom: 15px;
  color: #333;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-align: center;
}

#toc-content ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#toc-content li {
  margin: 10px 0;
  line-height: 1.4;
}

#toc-content .toc-h2 {
  font-weight: 700;
  font-size: 15px;
}

#toc-content .toc-h3 {
  margin-left: 1.5em;
  color: #666;
  font-size: 14px;
}

#toc-content a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}

#toc-content a:hover {
  color: var(--color-main);
  text-decoration: underline;
}

/* ==========================================================================
   6. Post Navigation - 前後の記事（カード型）
   ========================================================================== */

.post-navigation-minimal {
  margin: 20px auto;
  padding: 0;
}

.post-navigation-minimal .nav-links {
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.nav-previous,
.nav-next {
  flex: 1;
}

.post-navigation-minimal a {
  position: relative;
  z-index: 1;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 25px;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  background: var(--color-bg);
  text-decoration: none;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.post-navigation-minimal a:hover {
  border-color: var(--color-main);
  transform: translateY(-10%);
}

.post-navigation-minimal a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: var(--color-main);
  opacity: 0;
  transition: opacity 0.3s;
}

.post-navigation-minimal a:hover::before {
  opacity: 0.05;
}

.nav-meta {
  margin-bottom: 12px;
  color: var(--color-main);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nav-title {
  display: -webkit-box;
  overflow: hidden;
  color: #333;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.nav-previous a .nav-meta::before {
  content: '← ';
  transition: margin 0.3s;
}

.nav-next a .nav-meta::after {
  content: ' →';
  transition: margin 0.3s;
}

.nav-previous a:hover .nav-meta::before {
  margin-right: 8px;
}

.nav-next a:hover .nav-meta::after {
  margin-left: 8px;
}

.nav-next {
  text-align: right;
}

@media (max-width: 767px) {
  .post-navigation-minimal .nav-links {
    flex-direction: column;
    gap: 15px;
  }
  .nav-next {
    text-align: left;
  }
  .post-navigation-minimal a {
    padding: 20px;
  }
}

/* ==========================================================================
   7. Author & Search & Pagination - 各種アーカイブ要素
   ========================================================================== */

/* Author Page */
.archive.author .site-main { display: block; }

.author-page-header {
  margin-bottom: 60px;
  padding: 100px 20px 60px;
  border-bottom: 1px solid #eee;
  background: var(--color-bg);
  text-align: center;
}

.author-page-avatar img {
  width: 120px;
  height: 120px;
  margin-bottom: 25px;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.author-page-name {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.8rem;
  font-weight: 800;
}

.author-page-bio {
  max-width: 600px;
  margin: 0 auto;
  color: #666;
  line-height: 1.8;
}

.author-posts-divider {
  position: relative;
  margin: 60px 0 40px;
  text-align: center;
}

.author-posts-divider span {
  position: relative;
  z-index: 1;
  padding: 6px 20px;
  border-radius: 6px;
  background: var(--color-bg);
  color: #333;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.3em;
}

.author-posts-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-bg);
}

/* Search Results */
.search-page-header {
  margin-bottom: 40px;
  padding: 100px 20px 60px;
  border-bottom: 1px solid #eee;
  background: #f9fbfd;
  text-align: center;
}

.search-label {
  display: block;
  margin-bottom: 10px;
  color: var(--color-main);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.3em;
}

.search-query-title {
  color: #333;
  font-size: 1.8rem;
  font-weight: 800;
}

.search-count {
  margin-top: 10px;
  color: #666;
  font-size: 0.9rem;
}

.search-count strong {
  border-bottom: 2px solid var(--color-main);
  color: #333;
}

.no-results-content {
  grid-column: 1 / -1;
  padding: 100px 20px;
  text-align: center;
}

.search-bottom-area {
  grid-column: 1 / -1;
  margin: 60px auto 40px;
  padding: 50px 30px;
  border: 2px dashed #eee;
  border-radius: 15px;
  background: #fdfdfd;
  text-align: center;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-form .search-field {
  width: 100%;
  padding: 12px 15px;
  padding-right: 80px;
  border: 1px solid #ddd;
  border-radius: 30px;
  outline: none;
  flex-grow: 1;
}

.search-form .search-submit {
  position: absolute;
  top: 50%;
  right: 5px;
  padding: 8px 20px;
  border: none;
  border-radius: 25px;
  background-color: var(--color-main);
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background 0.3s;
}

.search-form .search-submit:hover {
  background-color: #005a87;
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  width: 100%;
  margin: 12px auto;
  padding-bottom: 32px;
  justify-content: center;
}

.pagination .nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination .page-numbers {
  display: inline-flex;
  min-width: 44px;
  height: 44px;
  padding: 0 15px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-default);
}

.pagination .page-numbers.current {
  border-color: var(--color-main);
  background: var(--color-main);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

.pagination .page-numbers:hover:not(.current) {
  border-color: var(--color-main);
  color: var(--color-main);
  transform: translateY(-2px);
}

/* ==========================================================================
   8. Others - 404 & Contact Form 7
   ========================================================================== */

/* Error 404 */
.error-404-container {
  display: flex;
  min-height: 70vh;
  padding: 60px 20px;
  background-color: #f9fbfd;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.error-icon {
  margin: 30px 0;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.error-title {
  margin-bottom: 20px;
  color: #333;
  font-size: 2.5rem;
  font-weight: 900;
}

/* Contact Form 7 */
.wpcf7 {
  max-width: 800px;
  margin: 40px auto;
  padding: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
}

.wpcf7 label {
  display: block;
  margin-bottom: 15px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: bold;
}

.wpcf7-form-control:not(.wpcf7-submit) {
  width: 100%;
  margin-top: 5px;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: var(--color-text-light);
  font-size: 1rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.wpcf7-form-control:focus {
  border-color: var(--color-main);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.wpcf7-submit {
  display: block;
  width: 200px;
  margin: 20px auto 0;
  padding: 15px 0;
  border: none;
  border-radius: 30px;
  background: var(--color-main);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
  transition: all 0.3s var(--ease-default);
}

.wpcf7-submit:hover {
  background: #006699;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
}

.wpcf7-not-valid-tip {
  margin-top: 5px;
  color: #d63031;
  font-size: 0.85rem;
}

.wpcf7-response-output {
  margin: 20px 0 0 !important;
  padding: 15px !important;
  border-radius: 8px !important;
  border-width: 1px !important;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 767px) {
  .wpcf7 {
    margin: 20px;
    padding: 25px 20px;
  }
}