/* ==========================================
 * タブレット・スマホ
 * 余白は common.css の --gap-* が画面幅で切り替わるので、ここでは並び方だけを変える
 * ========================================== */

/* style.css 後半の下層ページ用 .map 余白をトップでは打ち消す */
#access .map {
  margin-top: 0;
}

/* 縦書きラベル：画面が狭くなるほど左端に寄せ、確保する幅も小さく */
@media screen and (max-width: 1000px) {
  :root {
    --label-left: 14px;
    --label-space: 46px;
  }
}

/* スマホ：小さめの縦書きを各セクションの右上に。
 * セクションの上端をまたいで背景からはみ出し、コンテンツの右端にも少し重ねる */
@media screen and (max-width: 700px) {
  :root {
    --frame: 10px;
    --label-left: 6px;
    --label-space: 14px;
  }

  .sec_label {
    top: -20px;
    left: auto;
    right: 22px;
    font-size: 9px;
    letter-spacing: .3em;
  }

  /* INFORMATION・CLINIC・ACCESS は下げて、カードや写真の右上に重ねる */
  #information .sec_label,
  #concept .sec_label {
    top: calc(var(--gap-section, 70px) + -20px);
  }

  /* 受診の流れは背景の外にはみ出すと切れる（カルーセルのため overflow:hidden）ので内側に */
  #flow .sec_label {
    top: 16px;
  }

  /* ACCESS は見出しの下にある地図の右上に重ねる */
  #access .sec_label {
    top: calc(var(--gap-section, 70px) + 50px);
  }

  /* 写真・地図の上でも読めるよう、白いふちを薄く付ける */
  #concept .sec_label,
  #access .sec_label {
    text-shadow: 0 0 3px rgba(255, 255, 255, .9), 0 0 6px rgba(255, 255, 255, .7);
  }
}

@media screen and (max-width: 1100px) {

  #header,
  #header.m_fixed {
    padding: var(--gap-s);
  }

  #header.m_fixed {
    padding: var(--gap-xs) var(--gap-s);
  }

  #logo,
  #header.m_fixed #logo a {
    width: 260px;
    height: 32px;
    background-size: 260px;
  }

  .maintxt h2 {
    white-space: normal;
  }

  /* インフォメーション */
  .flex_1 {
    flex-direction: column;
  }

  .slide_img,
  .info-block {
    width: 100%;
  }

  /* コンセプト */
  .flex_2 {
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-xl);
  }

  .f_txt2,
  .f_img2 {
    width: 100%;
  }

  .flex_img {
    flex-direction: row;
    gap: 0;
  }

  .flex_img .f_img2 {
    width: calc(50% - var(--gap-s) / 2);
  }

  /* 診療のご案内：写真は小さくしてテキストと横並び（奇数は写真左・偶数は写真右） */
  .ser_cate_post li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    grid-template-rows: auto 1fr auto;
    row-gap: 0;
    column-gap: var(--gap-l);
    align-items: start;
  }

  .ser_cate_post li:nth-child(odd) {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .ser_txt1 {
    display: contents;
  }

  .ser_txt1 .txt_m {
    grid-row: 1;
    grid-column: 1;
    margin-bottom: var(--gap-s);
  }

  .ser_txt1 .txt_desc {
    grid-row: 2;
    grid-column: 1;
  }

  .ser_img1 {
    grid-row: 1 / 3;
    grid-column: 2;
    width: 100%;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .ser_cate_post li:nth-child(odd) .txt_m,
  .ser_cate_post li:nth-child(odd) .txt_desc {
    grid-column: 2;
  }

  .ser_cate_post li:nth-child(odd) .ser_img1 {
    grid-column: 1;
  }

  .ser_post {
    grid-row: 3;
    grid-column: 1 / -1;
  }

  /* アクセス */
  .flex_3 {
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-l);
  }

  .map,
  .map_txt {
    width: 100%;
  }

  .map {
    margin-top: 0;
  }

  /* フッタ */
  .ft_flex {
    flex-direction: column;
    gap: var(--gap-l);
  }

  #copyright ul,
  #copyright .txt_right {
    text-align: center;
  }
}

@media screen and (max-width: 700px) {

  body {
    font-size: 14px;
    letter-spacing: .1em;
    line-height: 2;
  }

  #logo,
  #header.m_fixed #logo a {
    width: 210px;
    height: 26px;
    background-size: 210px;
  }

  #mainvl {
    height: 500px;
    min-height: 500px;
  }

  .work-reset {
    width: 90%;
    margin: 0 auto;
  }

  .maintxt::before{
   inset: -40px -30px;
  }
  
  .maintxt h2 {
    font-size: 13px;
    line-height: 26px;
    letter-spacing: .1em;
    text-align: center;
  }

  .maintxt h2 br {
    display: none;
  }

  .ttl h2 {
    font-size: 20px;
    letter-spacing: .2em;
    margin-right: -.2em;
  }
  
  .scroll a {
    font-size: 12px;
    letter-spacing: .1em;
}

  .txt_m {
    font-size: 18px;
    line-height: 34px;
    letter-spacing: .15em;
  }

  .inr {
    padding: var(--gap-xl) var(--gap-s);
  }

  .cal_head h3 {
    font-size: 16px;
  }

  .cal_arrow {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    background-size: 11px;
  }

  .cal_prev { left: -10px; }
  .cal_next { right: -10px; }

  .news_post li a,
  .news_post2 li a {
    flex-direction: column;
    gap: 0;
  }

  .news_post .txt_n,
  .news_post2 .txt_n {
    font-size: 15px;
  }

  .ser_cate_post li,
  .ser_cate_post li:nth-child(odd) {
    padding: var(--gap-l) var(--gap-s);
  }

  /* スマホ：「選ばれる理由」と同じく、写真を小さめに中央へ置き、白いカードの上にはみ出させる。
   * その下に見出し・説明・タグを1列で */
  .ser_cate_post ul {
    padding-top: 36px;           /* 1枚目の写真がはみ出す分 */
  }

  .ser_cate_post li,
  .ser_cate_post li:nth-child(odd) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    padding-top: 0;
    margin-bottom: 64px;
  }

  .ser_cate_post li:last-child {
    margin-bottom: 0;
  }

  .ser_cate_post li .ser_img1,
  .ser_cate_post li:nth-child(odd) .ser_img1 {
    grid-row: 1;
    grid-column: 1;
    justify-self: center;
    width: 76%;
    aspect-ratio: 4 / 3;
    margin-top: -36px;
  }

  .ser_cate_post li .txt_m,
  .ser_cate_post li:nth-child(odd) .txt_m {
    grid-row: 2;
    grid-column: 1;
    margin: var(--gap-m) 0 0;
    text-align: center;
  }

  .ser_cate_post li .ser_txt1 .txt_desc,
  .ser_cate_post li:nth-child(odd) .ser_txt1 .txt_desc {
    grid-row: 3;
    grid-column: 1;
    margin-top: var(--gap-s);
  }

  .ser_cate_post li .ser_post {
    grid-row: 4;
  }

  .ser_post a,
  .ser_index a {
    padding: 6px 14px;
    font-size: 13px;
    letter-spacing: .1em;
  }

  .map iframe {
    height: 280px;
  }

  .btn2 a {
    display: block;
    text-align: center;
  }

  .ft_bg {
    padding: var(--gap-2xl) 0;
  }

  .ft_txt .fon1 {
    font-size: 36px;
    line-height: 60px;
  }

  .ft_txt p {
    font-size: 13px;
    line-height: 26px;
  }

  .ft_info {
    flex-direction: column;
    gap: var(--gap-s);
  }

  #logo2 {
    width: 260px;
  }
}

/* 下層ページ・当院について */
@media screen and (max-width: 1000px) {
  #subvl {
    height: 300px;
  }

  .reason_list {
    gap: var(--gap-s);
  }

  .reason_body {
    padding: var(--gap-s) var(--gap-xs) var(--gap-m);
  }

  .reason_body h3 {
    font-size: 18px;
    letter-spacing: .2em;
  }
}

@media screen and (max-width: 700px) {
  #subvl {
    height: 220px;
  }

  .reason_list {
    grid-template-columns: 1fr;
  }

  /* 選ばれる理由（650px以下）：写真を小さめに中央へ置き、白いカードの上にはみ出させる */
  .reason_list {
    gap: 64px;
    padding-top: 36px;           /* 1枚目の写真がはみ出す分 */
  }

  .reason_list li {
    padding: 0 var(--gap-s) var(--gap-xs);
  }

  .reason_img {
    width: 76%;
    margin: -36px auto 0;
  }

  /* 見出しは太字・中央。写真との間はトップの「産科・婦人科」と同じ余白 */
  .reason_body {
    padding-top: 0;
  }

  .reason_body h3 {
    margin-top: var(--gap-m);
    font-weight: 700;
    text-align: center;
  }

  .space_ttl {
    font-size: 18px;
    letter-spacing: .15em;
  }

  .space_lead {
    margin-top: var(--gap-l);
  }

  /* 写真：PCと同じ並び（左に横長2枚・右に縦長1枚）のまま、すき間だけ詰める */
  .space_gallery {
    gap: 8px;
    margin-top: var(--gap-xl);
  }
}

/* 初めての方へ */
@media screen and (max-width: 880px) {
  .intro_flex {
    flex-direction: column;
    gap: var(--gap-l);
  }

  .intro_txt,
  .intro_img {
    width: 100%;
  }
}

@media screen and (max-width: 700px) {
  .flow_item {
    width: min(300px, 80vw);
    padding: var(--gap-m) var(--gap-s);
  }

  .flow_ttl {
    font-size: 19px;
    letter-spacing: .2em;
  }

  .flow_slider .cal_arrow {
    width: 40px;
    height: 40px;
    margin-top: -20px;
    background-size: 11px;
  }

  .flow_prev { left: -12px; }
  .flow_next { right: -12px; }
}

/* 診療科目ページ：写真の幅を少し狭く → スマホは写真を上に */
@media screen and (max-width: 1000px) {
  .ser_detail_img {
    width: 240px;
  }
}

@media screen and (max-width: 700px) {
  .ser_detail,
  .ser_detail:nth-child(even) {
    flex-direction: column-reverse;
    gap: var(--gap-m);
    padding: var(--gap-m) var(--gap-s);
  }

  .ser_detail_img {
    width: 100%;
    aspect-ratio: 16 / 10;
  }

  .ser_check {
    columns: 1;
  }

  .ser_check li {
    line-height: 30px;
    letter-spacing: .1em;
  }

  .ser_check li::before {
    top: 6px;
  }
}

/* お知らせ：スマホは日付・カテゴリーの下にタイトル */
@media screen and (max-width: 700px) {
  .news_list a {
    flex-direction: column;
    gap: 4px;
    padding: var(--gap-s) 46px var(--gap-s) 0;
  }

  .news_list .news_meta {
    width: auto;
  }

  .news_list a::after {
    right: 0;
    width: 28px;
    height: 28px;
    margin-top: -14px;
  }

  .news_title {
    font-size: 15px;
    line-height: 26px;
  }

  .news_single_title {
    font-size: 18px;
  }

  .news_nav {
    flex-direction: column;
  }

  .news_nav > div {
    width: 100%;
  }
}

/* 院長あいさつ：写真は上に2枚並べ、プロフィールはその下に */
@media screen and (max-width: 880px) {
  .profile_flex {
    flex-direction: column;
    gap: var(--gap-l);
  }

  .profile_imgs {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap-s);
  }

  .profile_txt {
    padding-top: 0;
  }
}

@media screen and (max-width: 700px) {
  .profile_imgs {
    gap: var(--gap-xs);
  }

  .profile_name {
    font-size: 18px;
    letter-spacing: .15em;
  }

  .profile_position {
    font-size: 14px;
    letter-spacing: .15em;
  }

  .profile_list dt {
    font-size: 16px;
  }
}

/* 選ばれる理由：880〜651px は1列にして、カード内を「左に画像・右に文字」 */
@media screen and (min-width: 651px) and (max-width: 880px) {
  .reason_list {
    grid-template-columns: 1fr;
  }

  .reason_list li {
    display: flex;
    align-items: center;
    gap: var(--gap-m);
  }

  .reason_img {
    width: 42%;
    flex-shrink: 0;
  }

  .reason_body {
    flex: 1;
    padding: var(--gap-xs) var(--gap-s) var(--gap-xs) 0;
  }

  .reason_body .txt_desc {
    margin-top: var(--gap-s);
  }
}

/* 診療科目ページの導入：説明文と目次を上、画像を下に */
@media screen and (max-width: 880px) {
  .ser_intro_flex {
    flex-direction: column-reverse;
    gap: var(--gap-l);
  }

  .ser_intro_img {
    flex: none;
    width: 100%;
  }

  .ser_intro_body {
    width: 100%;
  }
}

/* 料金表：スマホは見出しの余白と文字を少し小さく */
@media screen and (max-width: 700px) {
  .price_sec_ttl {
    padding: 10px 12px;
    font-size: 15px;
    letter-spacing: .1em;
  }

  .price_sec_body {
    padding: 0 12px 10px;
  }

  .price_note {
    padding: 12px 14px;
  }
}
