/* Custom styles that extend Tailwind */

/* Organic shapes for decorative elements */
.shape-blob {
  border-radius: 42% 58% 70% 30% / 45% 45% 55% 55%;
}

.shape-leaf {
  border-radius: 0% 70% 0% 70% / 50% 50% 50% 50%;
}

/* Hero text shadow - Increase specificity */
.hero-section .hero-text-shadow {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background-color: theme("colors.cream.100");
}

::-webkit-scrollbar-thumb {
  background-color: theme("colors.moss.400");
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: theme("colors.moss.500");
}

/* Custom selection color */
::selection {
  background-color: theme("colors.moss.200");
  color: theme("colors.forest.900");
}

/* Comments styling */
.comment-list {
  list-style: none;
  padding: 0;
}

.comment {
  margin-bottom: 1.5rem;
}

.comment-body {
  padding: 1rem;
  border-radius: 0.5rem;
  background-color: theme("colors.cream.100");
}

.comment-meta {
  margin-bottom: 0.5rem;
}

.comment-author {
  font-weight: 600;
}

.comment-metadata {
  font-size: 0.875rem;
  color: theme("colors.charcoal.500");
}

.comment-content {
  margin-top: 0.5rem;
}

.comment-reply-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: theme("colors.moss.700");
}

.comment-reply-link:hover {
  color: theme("colors.moss.600");
}

.comment-form-comment label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.comment-form-comment textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 2px solid theme("colors.moss.200");
}

.comment-form-comment textarea:focus {
  outline: none;
  border-color: theme("colors.moss.400");
}

.form-submit .submit {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: theme("colors.forest.800");
  color: theme("colors.cream.50");
  border-radius: 9999px;
  font-weight: 500;
  transition: background-color 0.3s;
}

.form-submit .submit:hover {
  background-color: theme("colors.forest.700");
}

/* Gallery styling */
.wp-block-gallery {
  margin-bottom: 2rem;
}

.blocks-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.blocks-gallery-item {
  overflow: hidden;
  border-radius: 0.5rem;
}

.blocks-gallery-item img {
  transition: transform 0.5s;
}

.blocks-gallery-item:hover img {
  transform: scale(1.05);
}

/* Recipe styling */
.wp-block-recipe {
  background-color: theme("colors.cream.100");
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.recipe-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: theme("colors.forest.900");
  margin-bottom: 1rem;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid theme("colors.moss.200");
}

.recipe-meta-item {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: theme("colors.charcoal.600");
}

.recipe-meta-item svg {
  width: 1rem;
  height: 1rem;
  margin-right: 0.375rem;
}

.recipe-ingredients {
  margin-bottom: 1.5rem;
}

.recipe-ingredients h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: theme("colors.forest.800");
  margin-bottom: 0.75rem;
}

.recipe-ingredients ul {
  list-style: none;
  padding-left: 0.5rem;
}

.recipe-ingredients li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.recipe-ingredients li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  background-color: theme("colors.moss.400");
  border-radius: 50%;
}

.recipe-instructions h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: theme("colors.forest.800");
  margin-bottom: 0.75rem;
}

.recipe-instructions ol {
  list-style: none;
  counter-reset: recipe-steps;
  padding-left: 0.5rem;
}

.recipe-instructions li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 1rem;
  counter-increment: recipe-steps;
}

.recipe-instructions li::before {
  content: counter(recipe-steps);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 1.5rem;
  background-color: theme("colors.moss.400");
  color: theme("colors.forest.900");
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Social Share Buttons */
.social-share-button {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px; /* pill shape */
  font-size: 0.875rem; /* text-sm */
  font-weight: 500;
  color: white;
  transition: opacity 0.3s;
}

.social-share-button:hover {
  opacity: 0.85;
}

.social-share-button.twitter {
  background-color: #1DA1F2; /* Official Twitter Blue (pre-X) or use black #000000 */
}

.social-share-button.facebook {
  background-color: #1877F2; /* Official Facebook Blue */
}

.social-share-button.line {
  background-color: #06C755; /* Official LINE Green */
}

.social-share-button.hatena {
  background-color: #00A4DE; /* Official Hatena Blue */
  color: white; /* Ensure text is visible */
}

.social-share-button.hatena span {
  line-height: 1; /* Adjust line-height for text-only button */
}

/* Parallax Background */
.parallax-bg {
  /* JavaScriptで transform を制御 */
  transition: transform 0.1s linear; /* スムーズにするため */
}

/* Scroll Animation */
.scroll-animate {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.scroll-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Live Search Results */
#search-results-container {
  /* スクロールバーのデザインと干渉しないように少しパディング */
  padding-right: 5px; 
}

.search-result-item {
  border-bottom: 1px solid theme("colors.moss.100");
}

.search-result-item:last-child {
  border-bottom: none;
}

/* サムネイルがない場合のプレースホルダーアイコンの色など調整 */
.search-result-item .fa-image {
  opacity: 0.6;
}

/* ---------- おすすめ記事スライダー カスタムスタイル ---------- */
.featured-swiper {
  padding-top: 2rem;
  padding-bottom: 50px; /* Swiperのページネーションやナビゲーションボタンのための余白 */
  /* padding-left: 1rem; */ /* スライダー全体の左右のパディング */
  /* padding-right: 1rem; */
  overflow: hidden; /* Swiperがはみ出すのを防ぐ */
}

.featured-swiper .swiper-wrapper {
  display: flex;
  align-items: stretch; /* これにより、ラッパー内の全スライドが同じ高さになります */
}

.featured-swiper .swiper-slide {
  height: 100%; /* 親の align-items: stretch を有効にするために重要 */
  display: flex;
  flex-direction: column;
  background-color: #fff; /* カードの背景色 (Tailwindのbg-white/80と合わせるか確認) */
  border-radius: 0.5rem; /* Tailwindのrounded-lg相当 */
  border: 1px solid #e5e7eb; /* Tailwindのgray-200相当の枠線 */
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.07); /* 控えめな影 */
  overflow: hidden; /* 画像などがはみ出さないように */
}

.featured-swiper .swiper-slide:hover {
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); /* ホバー時の影 */
}

/* スライド内のリンク要素も高さを100%に */
.featured-swiper .swiper-slide a {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none; /* 念のため */
}

/* 画像コンテナのスタイル */
.featured-swiper .swiper-slide .aspect-video {
  flex-shrink: 0; /* 画像部分が縮まないように */
}

/* テキストコンテンツのコンテナ */
.featured-swiper .swiper-slide .p-5 {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 0.75rem; 
}

.featured-swiper .swiper-slide h3 {
  font-size: 0.875rem; /* PCでのフォントサイズ (style.cssと合わせる) */
  font-weight: 600; 
  color: #1f2937;    
  margin-bottom: 0.25rem; 
  line-height: 1.4;     
  /* 以下の行数制限関連のスタイルを削除またはコメントアウト */
  /* display: -webkit-box; */
  /* -webkit-line-clamp: 2; */
  /* -webkit-box-orient: vertical; */
  /* overflow: hidden; */
  /* text-overflow: ellipsis; */
  /* min-height: calc(1.4em * 2); */ 
}

.featured-swiper .swiper-slide .text-sm.text-charcoal-600.mb-4.line-clamp-2 {
    /* This class was likely for the excerpt which is now removed */
    /* If there are any remaining styles here causing issues, they can be removed or adjusted */
    /* For now, let's ensure it doesn't interfere with the title layout if it still exists in HTML */
    display: none; /* Or adjust as needed if the element is still there */
}

/* 日付などのフッター情報 */
.featured-swiper .swiper-slide .mt-auto {
  margin-top: auto; /* これにより、この要素はコンテナの最下部に配置される */
  font-size: 0.75rem; /* text-xs */
  color: #6b7280; /* text-charcoal-500 (仮) */
}

/* おすすめ記事スライダーのセクション全体での横スクロールを抑制 */
main.container > section.scroll-animate:has(.featured-swiper) {
  overflow-x: hidden;
}

/* Mobile Share Flyout Icons */
@media (max-width: 767px) { /* md breakpoint in Tailwind is typically 768px */
  #share-icons-container.flex {
    position: absolute;
    bottom: calc(100% + 0.5rem); /* Position above the trigger */
    right: 0;
    background-color: rgba(50, 50, 50, 0.9) !important; /* Semi-transparent background, ensure it overrides */
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    /* flex-direction: column; /* Ensured by Tailwind classes */
    /* align-items: center;   /* Ensured by Tailwind classes */
  }

  #share-icons-container.flex .social-share-flyout-icon {
    display: inline-flex !important; /* Ensure display properties */
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    color: white !important; /* Ensure icon color is white on dark background for mobile */
    font-size: 18px !important;
    transition: background-color 0.3s ease !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
    margin-bottom: 0.5rem; /* space between icons */
  }
  #share-icons-container.flex .social-share-flyout-icon:last-child {
    margin-bottom: 0; /* No margin for the last icon */
  }

  #share-icons-container.flex .share-label {
    color: white !important; /* Ensure label color is white for mobile flyout */
    margin-bottom: 0.75rem !important; /* Add some space below the label */
    font-size: 0.875rem !important; /* text-sm */
  }
}

/* PC Share Button Styles (Adjustments if needed) */
@media (min-width: 768px) {
  #social-share-flyout { /* The main fixed container */
    flex-direction: row !important; 
    align-items: center !important;
    width: auto !important; 
    height: auto !important;
    background-color: transparent !important; /* Ensure no unexpected background */
    padding: 0 !important;
    box-shadow: none !important;
  }

  #share-icons-container { /* This is inside social-share-flyout */
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.5rem !important;
    background-color: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    position: static !important; /* Stays within social-share-flyout's flow */
  }

  #share-icons-container .social-share-flyout-icon {
    display: inline-flex !important;
    align-items: center !important; /* Vertically center icon inside button */
    justify-content: center !important; /* Horizontally center icon inside button */
    width: 28px !important;  /* Slightly smaller size for PC */
    height: 28px !important; /* Slightly smaller size for PC */
    font-size: 14px !important; /* Adjust icon font size */
    color: #333 !important; /* PC icon color (adjust to your theme) */
    background-color: #f0f0f0 !important; /* PC icon background (adjust to your theme) */
    border-radius: 50% !important; 
  }

  #share-icons-container #copy-url-button i {
    /* color: #333 !important; /* 例えば黒系の色を指定 */
    /* 必要に応じて、コピーボタンのアイコンの色を個別に指定 */
  }

  /* Hide the "シェアする" label on PC by default */
  /* This will be controlled by md:hidden in footer.php, but as a fallback or for other contexts: */
  /* #share-icons-container .share-label {
    display: none !important; 
  } */
}

/* 最新の記事セクションの不要な直接子アンカーを非表示 */
.latest-posts-section .grid > a {
  display: none;
}

/* Featured Posts スライダー矢印を非表示 */
.featured-swiper .swiper-button-prev,
.featured-swiper .swiper-button-next {
  display: none;
}

/* --- モバイルヘッダー高さ・アイコン調整 --- */
@media (max-width: 768px) {
  .site-header {
    min-height: 48px !important;
    height: 48px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .site-header .flex.items-center.justify-between {
    height: 48px !important;
    min-height: 48px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .site-header .flex.items-center.gap-1 button {
    padding: 6px !important;
    height: 36px !important;
    width: 36px !important;
  }
  .site-header .flex-shrink-0 .h-8.w-8 {
    height: 32px !important;
    width: 32px !important;
  }
  .site-header .text-2xl {
    font-size: 1.2rem !important;
  }
}

/* --- 検索オーバーレイのモバイル最小化 --- */
@media (max-width: 768px) {
  #search-overlay {
    align-items: flex-start !important;
    padding: 0.5rem !important;
    justify-content: flex-start !important;
  }
  #search-overlay > div {
    margin-top: 20px !important;
    min-height: 0 !important;
    max-height: 60vh !important;
    height: auto !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  }
  #search-overlay .flex.justify-between.items-center.mb-4 {
    margin-bottom: 0.5rem !important;
  }
  #search-overlay .search-form {
    margin-bottom: 0.5rem !important;
  }
  #search-overlay .search-form .search-field {
    height: 2.4rem !important;
    font-size: 1rem !important;
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
  }
  #search-results-container {
    max-height: 30vh !important;
    min-height: 60px !important;
    padding-bottom: 0.5rem !important;
  }
  #search-overlay h3 {
    font-size: 1.1rem !important;
    margin-bottom: 0 !important;
  }
}
