/* レスポンシブデザイン */

/* 768px以下（モバイル） */
@media (max-width: 768px) {

  /* ヒーローセクション */
  .hero-section {
    height: auto;
    min-height: 55vh;
    max-height: 480px;
    border-bottom-left-radius: 30% 10%;
    border-bottom-right-radius: 30% 10%;
    position: relative;
    overflow: hidden;
    padding-top: 5rem;
    padding-bottom: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .top-logo { 
    top: 1.5rem;
  }
  
  .top-logo img {
    width: 150px; 
  }
  
  .center-logo {
    display: none; /* スマホでは非表示 */
  }
  
  .right-text {
    writing-mode: horizontal-tb;
    position: relative;
    display: block;
    text-align: center;
    color: white;
    width: 90%;
    max-width: 400px;
    margin: 0;
    right: auto;
    z-index: 5;
    line-height: 1.5;
  }
  
  .farm-location,
  .farm-description {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }
  
  /* モバイル用のロゴアニメーション */
  .top-logo img {
    transition: filter 0.5s ease;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    will-change: transform;
    width: 150px;
  }
  
  .top-logo img:hover {
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
  }

  /* ナビゲーション */
  .nav-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
  
  .nav-label {
    font-size: 0.9rem;
  }
  
  /* ハンバーガーメニューを表示 */
  .hamburger-button {
    display: block;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1003;
  }
  
  /* モバイルメニューは初期状態で非表示 */
  .mobile-nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 300px;
    height: 100vh;
    background-color: #ffffff;
    z-index: 1002;
    padding: 80px 20px 20px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: block;
    overflow-y: auto;
    backdrop-filter: none;
    isolation: isolate;
  }
  
  /* モバイルメニュー表示時 */
  .mobile-nav-menu[aria-hidden="false"] {
    transform: translateX(0);
  }
  
  /* モバイルメニュー内のナビゲーション */
  .mobile-nav-menu .nav-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    position: relative;
    z-index: 1003;
  }
  
  .mobile-nav-menu .nav-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    text-align: left;
    width: 100%;
    justify-content: flex-start;
    position: relative;
    z-index: 1003;
  }
  
  .mobile-nav-menu .nav-icon {
    width: 30px;
    height: 30px;
    margin-bottom: 0;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000000;
  }
  
  /* モバイルメニュー内のナビラベルを修正 */
  .mobile-nav-menu .nav-label {
    text-align: left;
    width: auto;
    flex-grow: 1;
    font-size: 0.95rem;
    white-space: nowrap;
    letter-spacing: 0.05em;
    display: block;
    color: #000000;
  }
  
  /* モバイルでは通常のナビゲーションセクションは拡大せず縮小 */
  .navigation-section {
    padding: 1rem 0.25rem;
    margin-bottom: -80px;
  }
  
  /* モバイル表示時の.nav-containerマージン調整 */
  .nav-container {
    margin: -13px auto;
  }
  
  /* ナビゲーションセクションのスタイル変更 */
  #main-navigation .nav-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
  }
  
  #main-navigation .nav-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 0.2rem;
  }
  
  #main-navigation .nav-label {
    font-size: 0.5rem;
  }
  
  /* 右テキストのモバイル調整 */
  .right-text {
    right: auto;
    justify-content: center;
  }
  
  /* 固定ナビゲーション表示時のスタイル調整 */
  .fixed-nav-wrapper.fixed-nav .fixed-nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  /* メニュー開いたときに背景をスクロールさせない */
  body.menu-open {
    overflow: hidden;
  }
  
  /* オーバーレイ */
  .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
  }
  
  .menu-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
  
  /* 農園紹介セクション */
  .farm-intro-section::before {
    background-image: url("../assets/images/background-mobile2.png");
    background-size: 100% 93%;
    height: 99%;
  }
  
  .farm-intro-section {
    padding: 3rem 0 2rem;
  }
  
  /* vegetables-recipes-sectionの上部パディングを調整 */
  .vegetables-recipes-section {
    padding-top: 1rem;
    margin-top: -60px;
  }
  
  .farm-intro-content {
    padding: 0;
  }
  
  .farm-intro-section .section-title {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    margin-top: 100px;
  }
  
  .farm-intro-section .farmer-main {
    margin-bottom: 2rem;
  }
  
  .farm-intro-section .farmer-main img {
    height: 200px;
  }
  
  .philosophy-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 1.5rem;
  }
  
  .philosophy-item {
    margin-bottom: 0rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 15px 15px 25px;
    /* モバイル向けの調整 */
    transform: none !important;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .philosophy-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    z-index: 0;
  }
  
  .philosophy-item::after {
    content: none;
    display: none;
  }
  
  .philosophy-item:active {
    transform: translateY(2px) !important;
    background-color: rgba(255, 255, 255, 0.8);
  }
  
  .philosophy-decoration {
    position: absolute !important;
    top: 110px !important;
    left: calc(50% - 85px) !important;
    bottom: auto !important;
    z-index: 3;
    width: 45px;
    order: 2;
    transition: transform 0.2s ease;
    /* アニメーションとtransformの上書き指定を削除 */
    /* animation: none !important; */
    /* transform: none !important; */
  }
  
  .philosophy-item:active .philosophy-decoration {
    transform: scale(1.1);
  }
  
  /* 畑に生きるを3番目に表示 */
  /* .philosophy-item:nth-child(2) { */
  /*   order: 1; */
  /* } */
  
  /* モバイル用のボタン調整 - タイトルの下に表示 */
  .philosophy-item:nth-child(2) .mobile-more-button {
    position: relative;
    text-align: center;
    margin: 1rem 0;
    z-index: 10;
    width: 100%;
  }
  
  /* 代表挨拶を一番上に表示 */
  /* .philosophy-item:nth-child(3) { */
  /*   order: -1; */
  /* } */
  
  .philosophy-grid .philosophy-item.community-life { /* 詳細度を上げる */
    order: 3; /* 3番目に表示 */
    margin-bottom: 150px!important; /* 元の下マージンを適用 */
  }
  
  .philosophy-item.farm-life {
    order: 2; /* 2番目に表示 */
    margin-bottom: 1rem; /* 必要に応じて調整 */
  }
  
  .philosophy-item.greeting {
    order: 1; /* 1番上に表示 */
    margin-bottom: 1rem; /* 必要に応じて調整 */
  }
  
  .philosophy-image {
    margin: 0 auto 1.5rem;
    z-index: 2;
    order: 1;
    width: 150px;
    height: 150px;
  }
  
  .philosophy-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    order: 3;
    position: relative;
    z-index: 1;
  }
  
  .philosophy-title {
    position: static;
    writing-mode: horizontal-tb;
    height: auto;
    min-height: auto;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    order: 1;
    z-index: 2;
  }
  
  .philosophy-text {
    padding: 0 0.5rem 0.5rem;
    margin-top: 0;
    text-align: left;
    min-height: auto;
    order: 2;
    width: 100%;
    position: relative;
    z-index: 2;
  }
  
  /* レシピセクション */
  .recipe-section-wrapper {
    padding: 2rem 0;
    margin-top: 3rem;
  }
  
  .recipe-collection-section {
    flex-direction: column;
    padding: 0 1.5rem;
  }
  
  .recipe-content {
    padding: 0 0.5rem;
  }
  
  .recipe-description {
    padding: 0 0.5rem;
    line-height: 1.9;
  }
  
  .recipe-image {
    width: 100%;
    margin-right: 0;
    margin-bottom: 1.5rem;
  }
  
  /* コラムセクション */
  .column-section {
    padding-top: 1rem;
    margin-bottom: 1.5rem;
  }
  
  /* ブログスライダー */
  .blog-swiper .swiper-button-prev,
  .blog-swiper .swiper-button-next {
    width: 35px;
    height: 35px;
  }
  
  .blog-swiper .swiper-button-prev::after,
  .blog-swiper .swiper-button-next::after {
    font-size: 16px;
  }
  
  /* ブレッドクラムネビゲーション */
  .breadcrumb-container {
    padding-top: 60px;
  }
  
  /* フッター */
  .site-footer::before {
    background-image: url("../assets/images/background-mobile2.png");
    background-size: cover;
    background-position: center center;
  }
  
  /* 見出し */
  .section-title,
  .section-header h2,
  .recipe-content h2,
  .column-section .section-header h2,
  .farm-intro-section .section-title {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
  }
  
  /* 野菜とレシピセクションの見出しにのみmargin-topを適用 */
  .vegetables-recipes-section .section-header h2 {
    margin-top: 50px;
  }
  
  .section-header h2 img,
  .recipe-content h2 img {
    width: 25px;
  }
  
  /* レシピ集の見出しを中央揃えに */
  .recipe-content h2 {
    justify-content: center;
    text-align: center;
    width: 100%;
  }
  
  /* ブログ関連 */
  .entry-title {
    font-size: 2rem;
  }
  
  .entry-content {
    font-size: 1rem;
  }
  
  .entry-content h2 {
    font-size: 1.6rem;
  }
  
  .entry-content h3 {
    font-size: 1.3rem;
  }
  
  .post-nav-links {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .prev-post, .next-post {
    max-width: 100%;
  }
  
  /* アーカイブページ */
  .archive-title {
    font-size: 2rem;
  }
  
  .archive-description {
    font-size: 1rem;
  }
  
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  
  .post-card-title {
    font-size: 1.2rem;
  }
  
  /* コメント */
  .comments-title,
  .comment-reply-title {
    font-size: 1.4rem;
  }
  
  .comment-list ol {
    margin-left: 1rem;
  }
  
  .comment-author img {
    width: 40px;
    height: 40px;
  }
  
  /* モバイル表示時のボタン切り替え */
  .desktop-more-button {
    display: none; /* PCボタンを非表示 */
  }
  
  .mobile-more-button {
    display: block; /* モバイルボタンを表示 */
    width: auto;
    margin-top: -104px; /* 上に詰める調整 */
  }
  
  /* philosophy-itemの最初の詳しく見るボタンを含むものを上に詰める */
  .philosophy-item:first-of-type.js-scroll-trigger {
    margin-top: 0; /* 上に詰める余白を削除 */
    margin-bottom: 10px; /* 下部の余白を調整 */
  }
  
  /* 詳しく見るボタンのモバイル調整 */
  .more-button {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    width: auto;
    display: inline-block;
  }
  
  /* モバイル用の目次セクション */
  .page-index-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .page-index-section {
    margin: 3rem 0 2rem;
    padding: 1.5rem 0;
  }
  
  .index-title {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
  }
  
  .page-index-image {
    height: 120px;
  }
  
  .page-index-name {
    font-size: 1rem;
  }
  
  .page-index-desc {
    font-size: 0.8rem;
  }
  
  /* 小さな詳しく見るボタンのモバイル調整 */
  .small-button-wrapper {
    display: none; /* 非表示に設定 */
  }
  
  .small-more-button {
    display: none; /* 非表示に設定 */
  }
  
  /* About目次ページのモバイル調整 - about-page.cssで定義されるため削除 */

  .philosophy-item.tapped {
    background-color: rgba(255, 255, 255, 0.7);
  }

  .philosophy-item.tapped::after {
    display: none;
  }

  /* ボタンコンテナのモバイル調整 */
  .view-more-button-container {
    text-align: center !important; /* モバイルでは中央揃え */
  }

  /* モバイルでカテゴリーセクションの2列表示を明示的に設定 */
  .categories-section {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  /* モバイル表示では、3番目以降のアイテムも均等に表示されるよう調整 */
  /* まず上の線のルールを明確に */
  .category-item:nth-child(1) .dotted-line:first-child,
  .category-item:nth-child(2) .dotted-line:first-child {
    display: block; /* 1行目の上部の線を表示 */
  }
  
  .category-item:nth-child(n+3) .dotted-line:first-child {
    display: none; /* 2行目以降の上部の線は非表示 */
  }
  
  /* 2行目以降のアイテムを調整（3番目以降が2行目になる） */
  .category-item:nth-child(n+3) {
    margin-top: -0.3rem; /* 行間の調整をリセット */
  }
  
  /* 3番目以降のテキスト位置を調整 */
  .category-item:nth-child(n+3) .category-title {
    padding: 0.5rem 0;
  }
}

/* 576px以下（小型モバイル） */
@media (max-width: 576px) {
  /* ヘッダー */
  .hero-section {
    min-height: 50vh;
    max-height: 420px;
    padding-top: 6.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .top-logo img {
    width: 120px;
  }
  
  .right-text {
    max-width: 350px;
    margin: 0 0 30px 0;
    right: auto;
  }
  
  .farm-location,
  .farm-description {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
  
  /* ナビゲーション */
  .nav-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
  }
  
  .nav-label {
    font-size: 0.62rem;
  }
  
  .nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 0.2rem;
  }
  
  .nav-item {
    padding: 0.25rem 0;
  }
  
  .mobile-nav-menu {
    width: 85%;
  }
  
  /* スクロールトップボタン */
  .scroll-top-button {
    width: 40px;
    height: 40px;
    bottom: 15px;
    right: 15px;
  }
  
  .scroll-top-button svg {
    width: 16px;
    height: 16px;
  }
  
  /* 農園紹介セクション */
  .farm-intro-section {
    padding: 2rem 0 1rem;
  }
  
  /* 小さい画面での野菜とレシピセクションの余白調整 */
  .vegetables-recipes-section {
    padding-top: 0.5rem;
    margin-top: -80px;
  }
  
  .farm-intro-section .section-title {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
  }
  
  .farm-intro-section .farmer-main img {
    height: 180px;
  }
  

  .philosophy-image {
    width: 120px;
    height: 120px;
  }
  
  .philosophy-decoration {
    top: 90px !important;
    left: calc(50% - 70px) !important;
    width: 40px;
    /* animation: none !important; */ /* アニメーション無効化を削除 */
    /* transform: none !important; */ /* transform無効化を削除 */
  }
  
  .philosophy-title {
    font-size: 1rem;
    padding: 0.4rem 1rem;
  }
  
  .philosophy-text {
    font-size: 0.87rem;
    line-height: 1.6;
  }
  
  /* レシピセクション */
  .recipe-collection-section {
    padding: 0 2rem;
  }
  
  /* コラムセクション */
  .column-section {
    padding-top: 0.5rem;
    margin-bottom: 1rem;
  }
  
  /* ブログスライダー */
  .blog-swiper .swiper-slide {
    width: 100% !important;
  }
  
  .blog-swiper {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* ブレッドクラムネビゲーション */
  .breadcrumb-container {
    padding-top: 50px;
  }
  
  .breadcrumbs {
    font-size: 0.8rem;
  }
  
  /* 404ページ */
  .error-404 {
    padding: 3rem 1rem;
  }
  
  .error-image {
    width: 150px;
  }
  
  .error-404 .page-title {
    font-size: 1.6rem;
  }
  
  .error-404 .page-content {
    font-size: 1rem;
  }
  
  .home-button {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
  }
  
  /* ブログ関連 */
  .entry-title {
    font-size: 1.6rem;
  }
  
  .entry-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .post-container {
    padding: 0 1rem 3rem;
  }
  
  .post-thumbnail img {
    width: 100%;
  }
  
  /* アーカイブページ */
  .archive-title {
    font-size: 1.6rem;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
  }
  
  .post-card-image {
    height: 180px;
  }
  
  /* コメント */
  .comment-body {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .comment-author .fn {
    font-size: 0.95rem;
  }
  
  .comment-form-comment textarea {
    height: 100px;
  }

  /* 小型モバイル向けの詳しく見るテキスト調整を削除 */
  .philosophy-item::after {
    display: none;
  }
}

/* 400px以下（極小モバイル） */
@media (max-width: 400px) {
  /* ヘッダー */
  .hero-section {
    min-height: 45vh;
    max-height: 380px;
    padding-top: 6rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .top-logo img {
    width: 100px;
  }
  
  .right-text {
    width: 95%;
  }
  
  .farm-location {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
  
  .farm-description {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
  }
  
  /* モバイルメニュー */
  .mobile-nav-menu {
    width: 90%;
  }
}

/* 769px～991px（タブレット） */
@media (min-width: 769px) and (max-width: 991px) {
  .center-logo {
    display: block;
  }
  
  .center-logo .farm-logo-center {
    width: 300px;
    height: auto;
    opacity: 1;
  }
  
  .right-text {
    opacity: 1;
  }
  
  /* ブログスライダー */
  .blog-swiper .swiper-slide {
    width: calc((100% - 20px) / 3) !important;
    margin-right: 10px !important;
  }
}

/* 992px以上（デスクトップ） */
@media (min-width: 992px) {
  .nav-label {
    font-size: 1.1rem;
  }
  
  /* ブログスライダー */
  .blog-swiper .swiper-slide {
    width: calc((100% - 40px) / 5) !important;
    margin-right: 10px !important;
  }
}

/* 768px以上（タブレット・デスクトップ） */
@media (min-width: 768px) {
  .philosophy-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* 代表挨拶を一番右（3列目）に表示 */
  .philosophy-item:nth-child(3) {
    order: 2; /* 一番右の列に配置 */
  }
  
  /* 畑に生きるを真ん中に表示 */
  .philosophy-item:nth-child(2) {
    order: 1; /* 真ん中の列に配置 */
  }
  
  /* 地域に生きるを一番左に表示 */
  .philosophy-item:nth-child(1) {
    order: 0; /* 一番左の列に配置 */
  }
  
  .activities-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .column-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .categories-section {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
  }
  
  .footer-container {
    grid-template-columns: 2fr 1fr 1fr;
  }
  
  /* Hide the default top lines for first 2 items */
  .category-item:nth-child(1) .dotted-line:first-child,
  .category-item:nth-child(2) .dotted-line:first-child {
      display: none; /* Override default styles */
  }

  /* Show top line for first 5 items (new first row) */
  .category-item:nth-child(-n+5) .dotted-line:first-child {
    display: block; /* Ensure visibility for 5-col layout */
  }
  
  /* Adjust top margin for second row in 5-column layout */
  .category-item:nth-child(n+6):nth-child(-n+10) {
    margin-top: -0.25rem; /* -0.5remから-0.25remへ変更 */
  }

  /* Fine-tune vertical text position for 5-column layout */
  .category-item:nth-child(-n+5) .category-title {
    padding: 0.5rem 0;
  }

  .category-item:nth-child(n+6):nth-child(-n+10) .category-title {
    padding: 0.5rem 0 0.5rem;
    margin-top: -0.3rem; /* ユーザー設定値を保持 */
  }
}

/* 576px以上のメディアクエリ */
@media (min-width: 576px) {
  .vegetable-item {
    width: calc((100% - 1 * 2rem) / 2);
    max-width: none;
  }
}

/* タブレット以上では野菜カードを3列にして、5件の段組みを3・2で整える */
@media (min-width: 769px) {
  .vegetable-item {
    width: calc((100% - 2 * 2rem) / 3);
  }
} 
