@charset "UTF-8";
/* ==========================================================================
   研修LP 講師紹介（section#trainer）のタブレット・スマホ幅（1023px以下）の上書き
   - 各クラスの classes/{slug}/assets/css/style.css より後に読み込む（functions.php の auto_enqueue_lp_assets()）
   - 読み込むクラスは functions.php の $trainer_css_targets で指定（現在は7本すべて：csm / a-csm / csp-sm / cspo / a-cspo / csp-po / csd。
     固定ページ「認定スクラムマスター」は lp-csm.php、「認定プロダクトオーナー」は lp-cspo.php を使うため、同じく読み込まれる）
   - 7本とも講師紹介のSCSSは同一。CSD の2人目にも当てる
   - 7本とも、Joe Justice の講師紹介の直後に「日本語のためのクラス」（#japanese）が入っている。
     そのため下の :has(+ .guest) と、:has(+ .trainer--second) は現状どれにも当たらない
     （日本語のためのクラスを外したときに、従来どおりの余白に戻るよう残している）
   - 既存CSSは1023px以下で、タイトル・写真・名前欄・説明文・実績リスト・ボタンを
     position:absolute の固定位置（top:601px など）で置き、セクションに padding-bottom:1169px を取っている。
     そのため文章量が変わると、空白が空いたり要素が重なったりする。
   - ここでは固定位置をやめて通常の流し込み（flex の縦並び）にする。見た目の順序は従来と同じ：
     タイトル → 写真・名前・SNS → 名前と肩書 → 説明文 → 実績の一部 → 講師紹介ページへボタン
   - 1024px以上（PC）には何も当てない。
   - CSDだけにある2人目の講師（section#trainer.trainer--second）も同じ作りで同じ崩れがあるため、同じ指定を当てる。
   - セレクタは #trainer（ID）を含めて、既存のクラス指定より詳細度で勝たせる（!important は使わない）。
   ========================================================================== */

@media screen and (max-width: 1023px) {
  /* 絶対配置のために確保していた下の余白（73.0625rem）をやめる。
     768〜1023px は PC と同じく、次のセクションの上余白（カリキュラム 6.5rem、ゲスト 5rem）に任せる */
  :is(#trainer.trainer, #trainer.trainer--second) {
    padding-bottom: 0;
  }

  /* 「日本語のためのクラス」（assets/css/lp-japanese.css）は、1023px以下では上の余白を控えめにしている
     （講師紹介の下に大きな padding-bottom がある前提）。その分をここで補う。
     :has() が効かない古いブラウザでは、補いがないだけ（間隔が少し狭くなるが重ならない） */
  :is(#trainer.trainer, #trainer.trainer--second):has(+ .lp-japanese) {
    padding-bottom: 3rem;
  }

  /* CSD の2人目は、1人目の下に余白があった前提で margin-top:0 になっている。1人目の上余白（5rem）と揃える */
  #trainer.trainer--second {
    margin-top: 5rem;
  }

  :is(#trainer.trainer, #trainer.trainer--second) .trainer__container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0; /* PC用の gap:6.5rem（横並びの間隔）が縦に効かないようにする。間隔は各要素の margin-top で取る */
  }

  /* 右カラムの枠を外し、中の要素（タイトル・名前欄・説明文・実績・ボタン）を写真と同じ縦並びに入れる */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__text-area {
    display: contents;
  }

  /* タイトルは HTML 上は写真より後ろにあるので、order で先頭に出す */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__title {
    order: -1;
    position: static;
    transform: none;
  }

  /* 写真・名前・SNS。上の間隔は既存の margin-top（0.875rem）をそのまま使う */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__img-area {
    position: static;
    transform: none;
  }

  /* SNS：見出し「SNS」は既存どおり上に絶対配置のまま、その下にリンクを横一列で流す。
     リンクの位置を left:5.3125rem などの固定値で置くのをやめ、高さも中身から決まるようにする
     （CSD の2人目は2つとも --01 で、固定位置だと「X」と「Udemy」が重なっていた） */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__sns {
    padding-top: 1.5625rem; /* 従来のリンクの位置（top:1.25rem + margin-top:0.3125rem）と同じ */
  }

  :is(#trainer.trainer, #trainer.trainer--second) .trainer__sns-item a {
    position: relative; /* ::before（▶︎）の基準として必要 */
    top: auto;
    left: auto;
    margin-top: 0;
  }

  /* 名前と肩書。上の間隔は PC と同じ 2.25rem */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__name-area {
    position: static;
    transform: none;
    margin-top: 2.25rem;
  }

  /* 説明文。上の間隔は従来の見た目（名前欄の下線から約30px）に合わせる */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__description {
    position: static;
    transform: none;
    margin-top: 1.875rem;
  }

  /* 実績の一部。上の間隔は PC と同じ 1.875rem */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__achievement-list {
    position: static;
    transform: none;
    margin-top: 1.875rem;
  }

  /* 講師紹介ページへボタン。上の間隔は PC と同じ 2.4375rem */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer-profile-btn {
    position: static;
    transform: none;
    margin-top: 2.4375rem;
  }
}

@media screen and (max-width: 767px) {
  /* 767px以下ではカリキュラムの margin-top が 0 になるので、講師紹介側で下に余白を取る（上の margin-top 5rem と揃える） */
  :is(#trainer.trainer, #trainer.trainer--second) {
    padding-bottom: 5rem;
  }

  /* 次が上余白を持つセクションのときは、二重にならないように減らす。
     :has() が効かない古いブラウザでは減らないだけ（間隔が広めになるが重ならない） */
  :is(#trainer.trainer, #trainer.trainer--second):has(+ .guest) {
    padding-bottom: 0; /* ゲストの margin-top 3.75rem に任せる */
  }

  #trainer.trainer:has(+ .trainer--second) {
    padding-bottom: 0; /* CSD の2人目の margin-top 5rem に任せる */
  }

  :is(#trainer.trainer, #trainer.trainer--second):has(+ .lp-japanese) {
    padding-bottom: 3rem; /* 日本語のためのクラスの margin-top 2rem と合わせて 5rem */
  }

  /* 説明文の上の間隔は、従来の見た目（名前欄の下線から約15px）に合わせる */
  :is(#trainer.trainer, #trainer.trainer--second) .trainer__description {
    margin-top: 0.9375rem;
  }
}
