/* スマホ表示（幅768px以下）。is-mobile クラスは site.js が付ける */
@media (max-width: 768px) {
  html, body { height: auto !important; }
  #dc-root { overflow-x: clip; }
  #dc-root > .sc-host > div:first-of-type { width: 100% !important; }
  img { max-width: 100%; }
  #dc-root h1, #dc-root h2, #dc-root h3, #dc-root p, #dc-root span, #dc-root a { overflow-wrap: anywhere; }

  /* 大見出しの中で文字を横並びにしている部分は、普通の文章として折り返す */
  /* 地域活動のキャッチコピー：2行を左右にずらして、デザインとして見せる */
  #dc-root h1:has(> span[style*="display: flex"]) { align-items: stretch !important; gap: 4px !important; padding: 6px 4px 14px; }
  #dc-root h1 > span[style*="display: flex"] { display: flex !important; flex-wrap: nowrap; white-space: nowrap; padding-left: 0 !important; }
  #dc-root h1 > span[style*="display: flex"]:first-child { justify-content: flex-start; }
  #dc-root h1 > span[style*="display: flex"]:last-child { justify-content: flex-end; }
  #dc-root h1:has(> span[style*="display: flex"])::after {
    content: ""; display: block; width: 72%; height: 0; margin: 10px auto 0;
    border-top: 2px dashed #E3B85A; border-radius: 2px; opacity: .8;
  }

  /* 区切りの見出し（例：身近な自然体験ラボがやっていること） */
  #dc-root .m-sec-title { text-align: center; margin-top: 10px !important; padding-bottom: 12px; position: relative; }
  #dc-root .m-sec-title::after {
    content: ""; position: absolute; left: 50%; bottom: 0; width: 44px; height: 3px; margin-left: -22px;
    border-radius: 3px; background: #A9BD8E;
  }

  /* 写真と文章の組み（サービス紹介など）：組ごとに区切る */
  #dc-root .m-media-row + .m-media-row { border-top: 1px dashed #E3DACA; padding-top: 18px !important; margin-top: 6px !important; }

  /* トップのファーストビュー：絵の上の文字を読みやすく */
  #dc-root .m-hero-text p, #dc-root .m-hero-text h1 { text-shadow: 0 0 6px #fff, 0 0 12px #fff, 0 0 18px rgba(255,255,255,.9); }

  /* ヘッダー：PC用ナビとボタンを隠し、ハンバーガーに */
  /* iPhoneのSafariでロゴの周りが黒く（またはベージュに）透ける対策：ヘッダーとロゴに白い地を持たせる */
  header { height: 72px !important; background: #FFFFFF !important; }
  header a:first-child, header a:first-child img { background: #FFFFFF !important; }
  header nav, header a[href="/contact/"] { display: none !important; }
  header > div { padding: 0 64px 0 16px !important; }
  header img { width: 34px !important; mix-blend-mode: normal !important; }
  header a span:first-child { font-size: 18px !important; letter-spacing: .08em !important; }
  header a span + span { font-size: 10px !important; letter-spacing: .04em !important; }
}

#m-menu-btn { display: none; }
#m-menu { display: none; }
@media (max-width: 768px) {
  #m-menu-btn {
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    position: absolute; top: 14px; right: 12px; z-index: 1001;
    width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 999px;
    background: #4F6B3E; cursor: pointer;
  }
  #m-menu-btn span { display: block; width: 24px; flex: none; height: 2px; border-radius: 2px; background: #fff; transition: transform .2s, opacity .2s; }
  .m-menu-open #m-menu-btn { position: fixed; }
  .m-menu-open #m-menu-btn span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .m-menu-open #m-menu-btn span:nth-child(2) { opacity: 0; }
  .m-menu-open #m-menu-btn span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  #m-menu {
    position: fixed; inset: 0; z-index: 1000; display: none; flex-direction: column;
    padding: 84px 24px 32px; background: #FFFFFF; overflow-y: auto;
    font-family: 'Zen Maru Gothic', sans-serif;
  }
  .m-menu-open #m-menu { display: flex; }
  .m-menu-open body { overflow: hidden; }
  #m-menu a {
    padding: 16px 4px; border-bottom: 1px solid #EFE9DD; color: #4A3C31;
    font-size: 16px; font-weight: 700; letter-spacing: .08em; text-decoration: none;
  }
  #m-menu a.m-menu-cta {
    margin-top: 28px; border: 0; border-radius: 999px; background: #4F6B3E; color: #fff; text-align: center;
  }
}

/* トップのイラスト：ページを開いたときに、ふわっと浮き上がるように表示（PC・スマホ共通） */
@keyframes hero-float-in {
  0%   { opacity: 0; transform: translateY(18px) scale(.97); filter: blur(6px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
#dc-root img[src*="hero-watercolor"] { animation: hero-float-in 1.6s cubic-bezier(.22,.8,.3,1) .15s both; }
@media (prefers-reduced-motion: reduce) {
  #dc-root img[src*="hero-watercolor"] { animation: none; }
}

/* トップのキャッチコピー「自然とつながる、学びと体験を。」：ページを開いたときに、ふわっと浮き上がるように表示（PC・スマホ共通） */
@keyframes catch-float-in {
  0%   { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}
body:has(img[src*="hero-watercolor"]) #dc-root h1 { animation: catch-float-in 1.3s cubic-bezier(.22,.8,.3,1) .1s both; }
@media (max-width: 768px) {
  /* スマホは表示直後に画面の調整が入るため、少し遅らせてゆっくり浮き上がらせる */
  body:has(img[src*="hero-watercolor"]) #dc-root h1 { animation-duration: 1.8s; animation-delay: .5s; }
}
@media (prefers-reduced-motion: reduce) {
  body:has(img[src*="hero-watercolor"]) #dc-root h1 { animation: none; }
}

/* トップのヒーロー（スマホ）：タグは3列のタイル、信頼の1行は小さく */
@media (max-width: 768px) {
  #dc-root [data-m="tags"] { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; margin-top: 0 !important; }
  #dc-root [data-m="tags"] a { flex-direction: column !important; justify-content: center !important; gap: 2px !important; padding: 6px 4px !important;
    border-radius: 12px !important; white-space: normal !important; text-align: center; font-size: 11px !important; line-height: 1.35 !important; letter-spacing: 0 !important; min-height: 56px; }
  #dc-root [data-m="tags"] a img { width: 20px !important; height: 20px !important; }
  #dc-root [data-m="trust"] { margin-top: 0 !important; font-size: 10.5px !important; letter-spacing: 0 !important; line-height: 1.5; white-space: nowrap; gap: 4px !important; }
  #dc-root [data-m="trust"] span:last-child { display: none; }
  #dc-root [data-m="tagline"] { font-size: 13px !important; letter-spacing: .08em !important; }
  #dc-root .m-hero-text { gap: 12px !important; }
}

/* 入口セレクタ（トップ・スマホ） */
#m-entry { display: none; }
@media (max-width: 768px) {
  #dc-root .m-hide { display: none !important; }
  #m-entry { display: block; position: relative; z-index: 1; padding: 4px 16px 28px; }
  #m-entry .m-entry-q { margin: 0 0 10px; text-align: center; font-family: 'Kiwi Maru', serif; font-size: 16px; letter-spacing: .1em; color: #5A3F30; }
  #m-entry .m-entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #m-entry .m-entry-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 150px; padding: 10px 8px 12px;
    border-radius: 18px; background: #fff; box-shadow: 0 4px 16px rgba(120,96,64,.12); text-align: center; text-decoration: none; color: #4A3C31; }
  #m-entry .m-entry-card.is-school { border-top: 4px solid #8FA974; }
  #m-entry .m-entry-card.is-machi { border-top: 4px solid #A9D0E8; }
  #m-entry .m-entry-card img { width: 58px; height: 58px; object-fit: cover; border-radius: 50%; margin-bottom: 4px; }
  #m-entry .m-entry-brand { font-size: 10px; letter-spacing: .04em; color: #8C7A66; }
  #m-entry .m-entry-who { font-family: 'Zen Maru Gothic', sans-serif; font-weight: 700; font-size: 13px; line-height: 1.4; color: #5A3F30; }
  #m-entry .m-entry-what { font-size: 11px; line-height: 1.4; color: #6E6053; }
  #m-entry .m-entry-arrow { position: absolute; right: 10px; bottom: 8px; font-size: 13px; font-weight: 700; color: #4F6B3E; }
  #m-entry .is-machi .m-entry-arrow { color: #3F6A86; }

  /* メニュー内の入口 */
  #m-menu .m-menu-entries { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  #m-menu a.m-menu-entry { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border: 0; border-radius: 14px; font-size: 13px; letter-spacing: .02em; line-height: 1.4; }
  #m-menu a.m-menu-entry small { font-size: 11px; font-weight: 500; color: #6E6053; }
  #m-menu a.m-menu-entry.is-school { background: #F1F5E8; }
  #m-menu a.m-menu-entry.is-machi { background: #EAF3F9; }
}

/* トップ（スマホ）：やっていること＝横スワイプ、すくわく・講師紹介＝コンパクト */
@media (max-width: 768px) {
  #dc-root .m-swipe { display: flex !important; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -20px; padding: 4px 20px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #dc-root .m-swipe::-webkit-scrollbar { display: none; }
  #dc-root .m-swipe .m-swipe-card { flex: 0 0 78% !important; scroll-snap-align: start; display: flex !important; flex-direction: column !important; gap: 8px !important;
    margin: 0 !important; padding: 10px 12px 14px !important; border: 0 !important; border-radius: 18px; background: #fff; box-shadow: 0 4px 16px rgba(120,96,64,.12); }
  #dc-root .m-swipe-card > div { padding: 0 !important; gap: 6px !important; }
  #dc-root .m-swipe-card > div:first-child, #dc-root .m-swipe-card [style*="order: -1"] { height: 120px !important; }
  #dc-root .m-swipe-card img { height: 120px !important; object-fit: cover; clip-path: none !important; border-radius: 12px; width: 100% !important; }
  #dc-root .m-swipe-card h3 { font-size: 15px !important; line-height: 1.45 !important; }
  #dc-root .m-swipe-card p { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px !important; line-height: 1.6 !important; }
  #dc-root .m-swipe-card a { font-size: 11.5px !important; padding: 6px 12px !important; min-height: 0 !important; }
  #dc-root .m-swipe-hint { margin: 2px 0 0; text-align: center; font-size: 11px; color: #A0907D; letter-spacing: .1em; }

  #dc-root .m-suku p { display: none !important; }
  #dc-root .m-suku img { max-height: 150px !important; object-fit: cover; }
  #dc-root .m-suku h2 { font-size: 20px !important; }

  #dc-root .m-prof > div { display: grid !important; grid-template-columns: 84px minmax(0, 1fr) !important; gap: 12px !important; align-items: start !important; }
  #dc-root .m-prof > div > div:first-of-type:not(:has(h2)) { height: 84px !important; min-height: 0 !important; position: relative; }
  #dc-root .m-prof img[src*="instructor"] { position: static !important; width: 84px !important; height: 84px !important; transform: none !important; left: auto !important; }
  #dc-root .m-prof h2 { font-size: 14px !important; line-height: 1.5 !important; letter-spacing: .02em !important; }
  #dc-root .m-prof h2 br { display: none; }
  #dc-root .m-prof p { display: -webkit-box !important; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px !important; line-height: 1.6 !important; }
  #dc-root .m-prof p br { display: none; }
  #dc-root .m-prof > div > div:has(h2) { gap: 6px !important; }
}

/* 下に固定の相談バー（トップ・スマホ） */
#m-cta-bar { display: none; }
@media (max-width: 768px) {
  #m-cta-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); box-shadow: 0 -4px 16px rgba(120,96,64,.12);
    transform: translateY(110%); transition: transform .25s ease; }
  .m-cta-show #m-cta-bar { transform: translateY(0); }
  .m-menu-open #m-cta-bar { transform: translateY(110%); }
  #m-cta-bar a { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 999px; font-family: 'Zen Maru Gothic', sans-serif;
    font-weight: 700; font-size: 14px; letter-spacing: .06em; text-decoration: none; color: #fff; }
  #m-cta-bar .m-cta-contact { background: #4F6B3E; }
  #m-cta-bar .m-cta-line { background: #06C755; }
}

/* 各ページの横スワイプ（スマホ） */
@media (max-width: 768px) {
  #dc-root .m-swipe2 { margin-left: -20px !important; margin-right: -20px !important; padding: 4px 20px 10px !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #dc-root .m-swipe2::-webkit-scrollbar { display: none; }
  #dc-root .m-swipe2 > * { flex: 0 0 var(--m-card-w, 78%) !important; scroll-snap-align: start; scroll-margin-left: 20px; min-width: 0 !important; margin: 0 !important; box-sizing: border-box; }
  #dc-root .m-swipe2 > *:not([style*="background"]) { background: #fff; border-radius: 18px; box-shadow: 0 4px 16px rgba(120,96,64,.10); padding: 12px !important; }
  #dc-root .m-swipe2 p { font-size: 12.5px !important; line-height: 1.65 !important; }
  #dc-root .m-swipe-hint { margin: 0 !important; text-align: center; font-size: 11px !important; color: #A0907D; letter-spacing: .1em; }
}
@media (max-width: 768px) {
  #dc-root [data-m-plan-row] { flex-direction: row !important; align-items: center !important; }
  #dc-root [data-m-plan-row] > div:last-child { text-align: left !important; align-items: flex-start !important; padding: 0 !important; }
  #dc-root [data-m-plan-row] > div:last-child > div { justify-content: flex-start !important; }
  #dc-root [data-m-plan-row] h3, #dc-root [data-m-plan-row] span { font-size: 14px !important; }
  #dc-root [data-m-plan-row] p { font-size: 12px !important; line-height: 1.5 !important; text-align: left !important; }
  #dc-root [data-m-plan-row] img[src*="sprout"], #dc-root [data-m-plan-row] img[src*="deco"] { display: none !important; }
}
@media (max-width: 768px) {
  #dc-root [data-m-plan-row] > div:last-child { min-width: 0 !important; flex: 1 1 auto !important; width: auto !important; }
  #dc-root [data-m-plan-row] > div:last-child * { white-space: normal !important; max-width: 100% !important; }
  #dc-root [data-m-plan-row] > div:last-child > div { flex-wrap: wrap !important; gap: 6px !important; }
}

/* 記事内の補足ボックス（例：ホリスタとは）のスマホ表示：左右に余白をとり、見出しを小さめに */
@media (max-width:768px){
  [data-m-note]{margin:0 20px !important;padding:22px 20px !important;width:auto !important;box-sizing:border-box}
  [data-m-note] h2{font-size:17px !important;letter-spacing:.02em !important}
  [data-m-note] h2 span{display:block}
  [data-m-note] > div > img{display:none}
  [data-m-note] p{font-size:14px !important;line-height:1.95 !important}
  [data-m-note] a{font-size:13px !important}
}

/* 記事の概要欄で、日付と対象を1行ずつ並べた欄（data-m-keep）：スマホでも1行に収まる大きさに */
@media (max-width:768px){
  [data-m-keep]{font-size:15px !important}
  [data-m-keep] [data-who]{font-size:13px !important}
  [data-m-keep] [data-dt]{flex-basis:7.7em !important}
}

/* 募集中のイベントがないときの案内と次回予告（スマホ） */
@media (max-width:768px){
  [data-noevent] > p{font-size:17px !important}
  [data-noevent] > p [data-sub]{font-size:12.5px !important}
  [data-noevent] > div{grid-template-columns:56px minmax(0,1fr) !important;gap:14px !important;padding:24px 18px 18px !important}
  [data-noevent] > div > svg{width:56px !important;height:auto !important}
  [data-noevent] > div p:first-child{font-size:17px !important}
}

/* スマホ：文章の折り返しを自然に（Safariの「整え折り返し」で行が早く切れ、右に空白ができるのを防ぐ） */
@media (max-width:768px){
  #dc-root p, #dc-root dd, #dc-root li { text-wrap: wrap !important; text-wrap-style: auto !important; }
  /* 記事の概要欄（日時・場所・参加者など）：見出しの列を細く、文字をひかえめに */
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns:56px"],
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns:72px"] { grid-template-columns: 4.2em minmax(0,1fr) !important; column-gap: 10px !important; }
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns"] > span:first-child { font-size: 12px !important; letter-spacing: .12em !important; }
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns"] > p { font-size: 15px !important; line-height: 1.55 !important; letter-spacing: .02em !important; }
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns"] > p span[style*="font-size:15px"],
  #dc-root [data-screen-label="02b 写真と概要"] [style*="grid-template-columns"] > p span[style*="font-size:14px"] { font-size: 12.5px !important; }
  #dc-root [data-screen-label="02b 写真と概要"] [style*="border-radius:28px"] { gap: 12px !important; padding: 20px 20px !important; }
  /* メニューの入口カード：「〜の方」が1文字だけ次の行に落ちないように */
  #m-menu a.m-menu-entry b { white-space: nowrap; font-size: 13px !important; letter-spacing: 0 !important; }
}

/* イベントページ：募集中カードの項目（場所・定員・参加費・時間）はスマホでは1列に、見出しは横書きのまま */
@media (max-width:768px){
  #dc-root [data-screen-label="03 募集中のイベント"] dl[style*="repeat(2"] { grid-template-columns: minmax(0,1fr) !important; gap: 10px !important; }
  #dc-root [data-screen-label="03 募集中のイベント"] dl[style*="repeat(2"] dt { width: 3.6em !important; flex: none; white-space: nowrap; }
  #dc-root [data-screen-label="03 募集中のイベント"] dl[style*="repeat(2"] dd { font-size: 14px !important; }
}
