/* SP（Figma「SP_TOP」node 38800:1049 ほか）。
   アートボードは 375px、本文の内側は 335px（左右 20px）。
   数値は Figma を 100% 表示したカンバスからの採寸。
   PC 版と訴求が食い違う箇所（病院案内の英字が CONDITIONS & TREATMENTS になっている等）は
   PC 版を正としている。 */

.u-sp { display: none; }

/* SP 専用のパーツは既定で消しておく（PC に素の状態で出てしまうため）。 */
.l-burger,
.l-drawer { display: none; }

/* ===== ヘッダーとドロワー =====
   グローバルナビは 1200px を切ると 9 項目が収まらないので、
   スマホだけでなくタブレットでもハンバーガー＋ドロワーに切り替える。 */
@media (max-width: 1199px) {
  .l-burger { display: grid; }
  .l-drawer { display: block; }

  /* ===== ヘッダー ===== */
  .l-header__inner { height: 76px; padding-inline: clamp(20px, 3vw, 40px); }
  .l-gnav, .l-header__contact, .l-header__sub { display: none; }
  .l-header__logo img { width: 38px; }
  .l-header__corp { font-size: 9px; }
  .l-header__name { font-size: 16px; letter-spacing: .18em; }

  .l-burger {
    display: grid;
    align-content: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0 2px;
  }
  .l-burger__bar {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--c-green-mid);
    transition: translate .25s, rotate .25s, opacity .2s;
  }
  .l-header:has(.l-burger[aria-expanded="true"]) .l-burger__bar:nth-child(1) { translate: 0 9px; rotate: 20deg; }
  .l-header:has(.l-burger[aria-expanded="true"]) .l-burger__bar:nth-child(2) { opacity: 0; }
  .l-header:has(.l-burger[aria-expanded="true"]) .l-burger__bar:nth-child(3) { translate: 0 -9px; rotate: -20deg; }

  /* ===== ドロワー ===== */
  body.is-drawer-open { position: fixed; width: 100%; overflow: hidden; }

  .l-drawer {
    position: fixed;
    inset: 0;
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #f2f6f6;
    opacity: 0;
    transition: opacity .3s ease;
  }
  .l-drawer.is-open { opacity: 1; }
  .l-drawer__inner { width: min(100%, 560px); margin-inline: auto; padding: 0 26px 56px; }

  .l-drawer__close {
    position: relative;
    display: block;
    width: 46px;
    height: 46px;
    margin: 14px 0 12px auto;
  }
  .l-drawer__close span {
    position: absolute;
    top: 50%;
    left: 4px;
    width: 38px;
    height: 1.5px;
    background: var(--c-green-mid);
  }
  .l-drawer__close span:nth-child(1) { rotate: 22deg; }
  .l-drawer__close span:nth-child(2) { rotate: -22deg; }

  /* 下層を持つ親項目。閉じているとき →、開いているとき ↓。 */
  .l-drawer__parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 17px 2px;
    border-bottom: 1px solid rgba(144, 144, 144, .35);
    font-family: var(--font-gothic);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--c-green-deep);
    text-align: left;
  }
  .l-drawer__arrow {
    position: relative;
    flex-shrink: 0;
    width: 18px;
    height: 12px;
    transition: rotate .25s ease;
  }
  .l-drawer__arrow::before,
  .l-drawer__arrow::after {
    content: "";
    position: absolute;
    background: var(--c-grey);
  }
  .l-drawer__arrow::before { top: 50%; left: 0; width: 18px; height: 1px; translate: 0 -50%; }
  .l-drawer__arrow::after {
    top: 50%; right: 0; width: 7px; height: 1px;
    transform-origin: right center; rotate: 40deg; translate: 0 -50%;
  }
  .l-drawer__parent.is-open .l-drawer__arrow { rotate: 90deg; }

  .l-drawer__child { padding: 6px 0 10px; }
  .l-drawer__child li a {
    display: block;
    padding: 10px 2px 10px 14px;
    font-family: var(--font-gothic);
    font-size: 15px;
    color: var(--c-green-deep);
  }

  .l-drawer__flat { margin-top: 26px; }
  .l-drawer__flat li a {
    display: block;
    padding: 11px 2px;
    font-family: var(--font-gothic);
    font-size: 15px;
    color: var(--c-green-deep);
  }

  .l-drawer__all a { font-weight: 700; }
  .l-drawer__grand a { padding-left: 30px; font-size: 14px; color: #3c6b4e; }
  .l-drawer__grand a::before { content: "└ "; opacity: .5; }
  /* 4 階層目。一般外来の子だと分かるよう、さらに字下げする。 */
  .l-drawer__great a { padding-left: 48px; font-size: 13px; color: #4c7a5c; }
  .l-drawer__great a::before { content: "└ "; opacity: .4; }

  /* 電話は最上位の導線なので、ドロワーでもボタンとして大きく置く。 */
  .l-drawer__tel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--c-green-deep);
    color: var(--c-wh);
  }
  .l-drawer__tel__icon svg { width: 26px; height: 26px; }
  .l-drawer__tel__note { display: block; font-size: 11px; opacity: .85; }
  .l-drawer__tel__num { display: block; font-family: var(--font-num); font-size: 26px; font-weight: 500; line-height: 1.1; }

  .l-drawer__sns { display: flex; gap: 14px; margin-top: 22px; padding: 0 2px; }
  .l-drawer__sns img { width: 42px; height: 42px; }

  .l-drawer__contact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
    padding: 16px 0;
    border-top: 1px solid rgba(144, 144, 144, .35);
    border-bottom: 1px solid rgba(144, 144, 144, .35);
    font-family: var(--font-gothic);
    font-size: 16px;
    font-weight: 700;
    color: var(--c-green-deep);
  }
  .l-drawer__contact svg { width: 20px; height: 20px; color: var(--c-green-deep); }

}

@media (max-width: 767px) {

  .u-pc { display: none; }
  .u-sp { display: initial; }

  /* 375px 基準。左右 20px の余白で本文 335px。 */
  .l-inner { width: min(100% - 40px, 335px); }

  .l-header__inner { height: 66px; padding-inline: 20px; }

  /* ===== FV =====
     3 列 ×4 段のモザイク。DOM は PC の並びなので order で組み替え、
     3 枚目（笑顔の医師）と 5 枚目（眼鏡の医師）を縦 2 段ぶんにする。 */
  .p-fv { aspect-ratio: 375 / 488; } /* FV 直下の電話・アクセス（68px）を廃止した分、写真を縦に広げる */
  .p-fv__mosaic { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
  .p-fv__mosaic picture { display: block; min-height: 0; }
  .p-fv__mosaic picture:nth-child(1) { order: 1; }
  .p-fv__mosaic picture:nth-child(2) { order: 2; }
  .p-fv__mosaic picture:nth-child(4) { order: 3; }
  .p-fv__mosaic picture:nth-child(6) { order: 4; }
  .p-fv__mosaic picture:nth-child(7) { order: 5; }
  .p-fv__mosaic picture:nth-child(3) { order: 6; grid-row: span 2; }
  .p-fv__mosaic picture:nth-child(5) { order: 7; grid-row: span 2; }
  .p-fv__mosaic picture:nth-child(8) { order: 8; }
  .p-fv__mosaic picture:nth-child(9) { order: 9; }
  .p-fv__mosaic picture:nth-child(10) { order: 10; }
  .p-fv__mosaic img { height: 100%; }

  /* SP は縦書き。右端が「やすらぎと信頼と、安心を。」、その左にリード文が折り返す。
     高さを 100% に固定しないと 1 列に収まらず、はみ出したり妙な位置で折り返す。 */
  .p-fv__copy {
    top: 24px;
    right: 18px;
    bottom: 24px;
    left: auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
  }
  .p-fv__title,
  .p-fv__lead {
    writing-mode: vertical-rl;
    height: 100%;
    margin: 0;
  }
  .p-fv__title {
    font-size: 25px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: .06em;
  }
  .p-fv__lead {
    font-size: 12px;
    font-weight: 400;
    line-height: 2;
    letter-spacing: .04em;
  }


  /* ===== お知らせ ===== */
  /* SP は 見出し → 一覧 → 「お知らせ一覧へ」 の縦並び。 */
  .p-news { padding: 54px 0 52px; }
  .p-news__inner { display: contents; }
  .p-news { display: flex; flex-direction: column; align-items: center; }
  .p-news__head { display: contents; }
  .p-news__head .c-heading { order: 1; text-align: center; }
  .p-news__list { order: 2; width: min(100% - 40px, 335px); margin-top: 20px; }
  .p-news__head .c-link { order: 3; margin-top: 20px; }
  .p-news__item a { grid-template-columns: 92px 1fr; gap: 8px; padding: 12px 0; }
  .p-news__date { font-size: 14px; }
  .p-news__title { font-size: 14px; }

  /* ===== 見出し ===== */
  .c-heading__ja { font-size: 24px; }
  .c-heading__en { font-size: 14px; margin-top: 4px; }
  .c-heading--center .c-heading__ja { gap: 18px; }

  /* ===== 診療案内 ===== */
  .p-service { padding: 54px 0 60px; }
  .p-service__cards { grid-template-columns: 1fr; gap: 22px; margin-top: 30px; }
  .p-service__body { padding: 38px 18px 26px; }
  .p-service__ja { font-size: 20px; }
  .p-service__en { font-size: 13px; }
  .p-service__text { font-size: 14px; line-height: 1.9; }
  .p-service__badge { width: 44px; height: 44px; }
  .p-service__badge svg { width: 24px; height: 24px; }

  /* 小カードは SP では 2 列。アイコンを上、文字を下の縦並びにする。 */
  .p-service__list { grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 34px; }
  .p-service__item a {
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    height: 118px;
    padding: 12px 8px;
    text-align: center;
  }
  .p-service__icon { width: 44px; height: 44px; }
  .p-service__icon svg { width: 24px; height: 24px; }
  .p-service__label-ja { font-size: 16px; }
  .p-service__label-en { font-size: 10px; letter-spacing: .08em; }
  /* Figma の SP は 外来・入院／デイケア・作業療法／訪問診療・訪問看護 の順。 */
  .p-service__list .p-service__item:nth-child(1) { order: 1; }
  .p-service__list .p-service__item:nth-child(2) { order: 2; }
  .p-service__list .p-service__item:nth-child(5) { order: 3; }
  .p-service__list .p-service__item:nth-child(6) { order: 4; }
  .p-service__list .p-service__item:nth-child(3) { order: 5; }
  .p-service__list .p-service__item:nth-child(4) { order: 6; }

  /* 枠線だけのリンクカードは横並びのまま 1 列に積む。 */
  .p-service__links { grid-template-columns: 1fr; gap: 12px; margin-top: 20px; }
  .p-service__item--outline a { flex-direction: row; height: 76px; gap: 14px; padding: 0 16px; text-align: left; }
  .p-service__item--outline .p-service__label-en { font-size: 11px; }

  /* ===== 診療時間・アクセス ===== */
  .p-hours { padding: 0 0 54px; }
  .p-hours__box { grid-template-columns: 1fr; gap: 16px; padding: 0; border: 0; }
  .p-hours__table { padding: 18px 16px; text-align: center; }
  .p-hours__row { grid-template-columns: 1fr; gap: 4px; }
  .p-hours__row dt { font-size: 16px; color: var(--c-wh); }
  .p-hours__row dd { font-size: 14px; }
  .p-hours__row + .p-hours__row { margin-top: 16px; }
  .p-hours__note { font-size: 13px; }
  .p-hours__lead { margin-top: 0; font-size: 18px; }
  .p-hours__tel a { font-size: 26px; }
  .p-hours__tel svg { width: 20px; height: 20px; }
  .p-hours__addr { font-size: 13px; }
  .p-hours__bus span { font-size: 14px; padding: 9px; }
  /* 時間・休診日は緑地に白文字、電話まわりは白いカード。 */
  .p-hours__left > .p-hours__lead,
  .p-hours__left > .p-hours__tel,
  .p-hours__left > .p-hours__addr,
  .p-hours__left > .p-hours__bus { background: var(--c-wh); }
  .p-hours__left > .p-hours__lead { padding: 22px 16px 0; border-radius: 8px 8px 0 0; margin-top: 16px; }
  .p-hours__left > .p-hours__tel { padding: 8px 16px 0; }
  .p-hours__left > .p-hours__addr { padding: 4px 16px 0; }
  .p-hours__left > .p-hours__bus { padding: 12px 16px 20px; border-radius: 0 0 8px 8px; margin-top: 0; }

  /* ===== 初めての方へ =====
     SP は写真の上に見出し、下に本文。PC のような重ねカードにはしない。 */
  .p-first { display: flex; flex-direction: column; }
  .p-first__bg { aspect-ratio: 375 / 126; order: 2; }
  .p-first__wrap,
  .p-first__card { display: contents; }
  .p-first__card .c-heading {
    order: 1;
    display: block;
    padding: 22px 20px 20px;
    background: linear-gradient(180deg, #d9edd9 0%, #cfe8dd 100%);
  }
  .p-first__card .c-heading__ja { display: flex; gap: 16px; font-size: 22px; }
  .p-first__card .c-heading__ja::before,
  .p-first__card .c-heading__ja::after { content: ""; }
  .p-first__text {
    order: 3;
    margin: 0;
    padding: 20px;
    font-size: 14px;
    background: linear-gradient(180deg, #e7f4ea 0%, #eef7f3 100%);
  }
  .p-first__card .c-link {
    order: 4;
    margin: 0;
    padding: 0 0 24px;
    background: linear-gradient(180deg, #eef7f3 0%, #f2f9f5 100%);
  }

  /* ===== 中村病院の特徴 ===== */
  .p-feature { padding: 54px 0 56px; }
  .p-feature__row {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: min(100% - 40px, 335px);
    margin-top: 30px;
    direction: ltr;
  }
  .p-feature__row--rev { direction: ltr; }
  .p-feature__thumb { order: 1; }
  .p-feature__body { order: 2; }
  .p-feature__title { gap: 12px; }
  .p-feature__no { font-size: 32px; }
  .p-feature__ja { font-size: 21px; line-height: 1.5; }
  .p-feature__text { margin-top: 18px; padding-top: 18px; font-size: 14px; }
  .p-feature__body .c-link { display: flex; justify-content: center; margin-top: 18px; }

  /* ===== 対応疾患 ===== */
  .p-disease { padding: 54px 0 56px; }
  .p-disease__list { grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 30px; }
  .p-disease__item a {
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    height: 118px;
    padding: 12px 8px;
    text-align: center;
  }
  .p-disease__icon { width: 46px; height: 46px; }
  .p-disease__label { flex: none; font-size: 15px; line-height: 1.45; }
  /* 括弧書きは行を分ける。「双極性障害(躁うつ」で切れるのを防ぐ。 */
  .p-disease__sub { display: block; }
  .p-disease__item .c-link__arrow--sm { display: none; }

  /* ===== 病院案内 ===== */
  .p-info { padding: 0 0 54px; }
  .p-info__list { grid-template-columns: 1fr; gap: 14px; margin-top: 30px; }
  .p-info__label { font-size: 18px; }

  /* ===== 採用情報 ===== */
  /* SP は 見出し帯 → 写真 → 本文 → リンク の縦並び。 */
  .p-recruit { padding: 0 0 54px; }
  .p-recruit__inner { display: flex; flex-direction: column; }
  .p-recruit__body { display: contents; }
  .p-recruit__body .c-heading {
    order: 1;
    padding: 22px 20px 20px;
    background: linear-gradient(180deg, #d9edd9 0%, #d3ebdd 100%);
  }
  .p-recruit__thumb { order: 2; }
  .p-recruit__thumb img { border-radius: 0; }
  .p-recruit__text {
    order: 3;
    margin: 0;
    padding: 18px 20px 0;
    font-size: 14px;
    background: linear-gradient(180deg, #e7f4ea 0%, #edf6f1 100%);
  }
  .p-recruit__body .c-link {
    order: 4;
    margin: 0;
    padding: 16px 20px 22px;
    background: linear-gradient(180deg, #edf6f1 0%, #f1f8f4 100%);
  }

  /* ===== 通院費や生活費でお悩みの方へ ===== */
  .p-support { padding: 0 0 54px; }
  .p-support__lead { margin-top: 22px; font-size: 15px; line-height: 1.9; }
  .p-support__list { grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 26px; }
  .p-support__item a { height: 110px; gap: 10px; padding: 12px 8px; }
  .p-support__label { font-size: 15px; }
  .p-support__item .c-link { font-size: 12px; gap: 6px; }

  /* ===== 関連施設 ===== */
  .p-links { padding: 0 0 54px; }
  .p-links__list { grid-template-columns: repeat(2, 1fr); gap: 26px 14px; margin-top: 30px; }
  .p-links__name { margin-top: 12px; font-size: 16px; }
  .p-links__text { margin-top: 10px; font-size: 12px; line-height: 1.85; }
  .p-links__info { margin-top: 10px; font-size: 12px; line-height: 1.85; }
  .p-links__item .c-link { font-size: 12px; }

  /* ===== よくアクセスされるページ ===== */
  .p-popular { padding: 0 0 44px; }
  .p-popular__inner { display: block; }
  .p-popular__inner .c-heading { text-align: center; }
  .p-popular__inner .c-heading__ja { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 20px; }
  .p-popular__inner .c-heading__ja::before,
  .p-popular__inner .c-heading__ja::after { content: ""; flex: 1; height: 1px; background: var(--c-green-mid); }
  .p-popular__inner .c-heading__ja br { display: none; }
  .p-popular__list { grid-template-columns: repeat(2, 1fr); gap: 0 14px; margin-top: 22px; }
  .p-popular__item a {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 0;
    padding: 14px 0;
  }
  .p-popular__icon { width: 44px; height: 44px; flex-shrink: 0; }
  .p-popular__icon--outline svg { width: 22px; height: 22px; }
  .p-popular__label { margin-top: 0; font-size: 14px; }

  /* ===== バナー ===== */
  .p-banner { padding: 0 0 44px; }
  .p-banner__list { grid-template-columns: 1fr; gap: 12px; }

  /* ===== フッター ===== */
  .l-footer { padding-bottom: 40px; }
  .l-footer__catch {
    justify-content: center;
    padding-top: 44px;
    font-size: 18px;
  }
  .l-footer__catch::after { content: none; }
  .l-footer__top { grid-template-columns: 1fr; gap: 0; margin-top: 18px; }
  .l-footer__info { text-align: center; }
  .l-footer__logo { display: block; }
  .l-footer__name { font-size: 18px; }
  .l-footer__addr { margin-top: 12px; font-size: 14px; line-height: 1.9; }
  /* 直後の診療時間表が margin-top:0 のため、間隔はこちらで確保する。 */
  .l-footer__bus { max-width: none; margin-top: 14px; margin-bottom: 14px; }
  .l-footer__bus span { font-size: 14px; }

  /* 診療時間の表は SP では緑地に白文字。 */
  .l-footer__table {
    max-width: none;
    margin-top: 0;
    padding: 14px 12px;
    border-radius: 0;
    background: #7fbd93;
    color: var(--c-wh);
    font-size: 13px;
  }
  .l-footer__table thead th:first-child,
  .l-footer__table tbody th { width: 92px; color: var(--c-wh); }
  .l-footer__table tbody tr { border-top: 1px solid rgba(255, 255, 255, .45); }
  .l-footer__notes { padding: 0 12px 16px; background: #7fbd93; color: var(--c-wh); }
  .l-footer__notes .l-footer__note { color: var(--c-wh); }
  .l-footer__map { margin-top: 0; }
  .l-footer__map img { border-radius: 0; }

  .l-footer__nav { grid-template-columns: repeat(2, 1fr); gap: 26px 16px; margin-top: 34px; }
  .l-footer__col--wide { grid-column: 1 / -1; }
  .l-footer__col--last { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
  .l-footer__col--last ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; }
  .l-footer__col--last li + li { margin-top: 0; }
  .l-footer__head { font-size: 15px; padding-bottom: 10px; margin-bottom: 12px; }
  .l-footer__col a { font-size: 13px; }
  .l-footer__list--2col { gap: 10px 14px; }
  .l-footer__copy { margin-top: 34px; }
}

/* ===== 表：スマホで横スクロールするとき、左端の列を固定する =====
   診療時間・受付時間・担当医表は列が多く、横スクロールすると
   「午前／午後」がどの行か分からなくなるため。 */
@media (max-width: 767px) {
  /* 列が少なく横スクロールの必要がない表（運行時刻表・募集職種など）は
     .c-table--nofix を付けて固定の対象から外す。固定すると 1 列目が幅を取り、
     かえって読みにくくなるため。 */
  .c-table:not(.c-table--nofix) thead th:first-child,
  .c-table:not(.c-table--nofix) tbody th[scope="row"] {
    position: sticky;
    left: 0;
    z-index: 2;
    /* border-collapse: collapse では固定セルの右罫線が流れてしまうので影で描く */
    box-shadow: 1px 0 0 #d7e4dc;
  }
  .c-table:not(.c-table--nofix) thead th:first-child {
    z-index: 3;
  }
}
