/*
Theme Name: My Custom Theme
Author: Your Name
Description: 合同会社学優社 企業サイト用カスタムテーマ（コンパクト・横並び・全見出し0.5文字境界またぎ・取引先ホバー演出・背景固定インセット・バグ修正完全版）
Version: 1.8
*/

/* ==========================================================================
   1. ベースリセット & rem管理設定 (1rem = 10px)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 62.5%; /* 1rem ＝ 10px */
  scroll-behavior: smooth;
}

:root {
  --primary-color: #1a365d;   /* 信頼感のある深い紺色 */
  --text-color: #333333;      /* メインの文字色 */
  --bg-light: #f8fafc;        /* 薄いグレーの背景色 */
  --accent-gray: #71717a;     /* ボタン等に使用する落ち着いたグレー */
  --border-color: #e2e8f0;    /* 境界線 */
  --font-family: "Noto Serif JP", "Hiragino Mincho ProN", "MS Mincho", serif;
}

body {
  font-family: var(--font-family);
  color: var(--text-color);
  font-size: 1.6rem;
  line-height: 1.8;
  overflow-x: hidden;
  background-color: #ffffff;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s ease;
}
a:hover { opacity: 0.8; }

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* リンク先がない無効なリンクの挙動をリセット */
.disabled-link {
  cursor: default !important;
  pointer-events: none !important;
  color: inherit !important;
  text-decoration: none !important;
}

/* ==========================================================================
   2. 共通レイアウトクラス & 共通見出し
   ========================================================================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2.0rem;
}

.section-padding {
  padding: 7.0rem 0;
}

/* ★日本語タイトル共通：すべて4px大きい「3.6rem (36px)」に統一 */
.tate-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 3.6rem;
  letter-spacing: 0.4em;
  color: var(--primary-color);
  font-weight: 300;
  line-height: 1;
}

/* ==========================================================================
   3. ヘッダー & ナビゲーション
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 8.0rem;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0.2rem 1.0rem rgba(0, 0, 0, 0.05);
  z-index: 1000;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 4.0rem;
}

.logo { display: flex; align-items: center; }
.logo a { display: block; height: 4.5rem; }
.logo img { height: 100%; width: auto; object-fit: contain; }

.pc-nav ul { display: flex; list-style: none; gap: 3.5rem; }
.pc-nav a { font-size: 1.5rem; font-weight: 500; color: var(--text-color); position: relative; padding-bottom: 0.5rem; }
.pc-nav a::after { content: ""; position: absolute; bottom: 0; left: 0; width: 0; height: 0.1rem; background-color: var(--primary-color); transition: width 0.3s ease; }
.pc-nav a:hover::after { width: 100%; }

/* ★現在地（カレントページ）の下線表示スタイル */
.pc-nav a.is-current {
  color: var(--primary-color);
  font-weight: 600;
}
.pc-nav a.is-current::after {
  width: 100%;
}

/* ★SPハンバーガーボタン：何があっても最前面に固定表示 */
.burger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 3.0rem;
  height: 2.4rem;
  position: fixed !important;
  right: 2.0rem;
  top: 2.8rem; /* ヘッダーの高さの中央付近に配置 */
  z-index: 9999 !important;
}
.burger-btn span {
  display: block;
  position: absolute;
  width: 100%;
  height: 0.2rem;
  background: var(--primary-color);
  left: 0;
  transition: all 0.3s ease;
}
.burger-btn span:nth-child(1) { top: 0; }
.burger-btn span:nth-child(2) { top: 1.1rem; }
.burger-btn span:nth-child(3) { top: 2.2rem; }

.burger-btn.is-active span:nth-child(1) { transform: translateY(1.1rem) rotate(45deg); }
.burger-btn.is-active span:nth-child(2) { opacity: 0; }
.burger-btn.is-active span:nth-child(3) { transform: translateY(-1.1rem) rotate(-45deg); }

/* SPナビゲーション：重ね順をハンバーガーボタンの直下に配置 */
.sp-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  height: 100vh;
  background: #ffffff;
  z-index: 9998 !important;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 12.0rem 4.0rem 4.0rem;
  box-shadow: -0.5rem 0 1.5rem rgba(0, 0, 0, 0.1);
}
.sp-nav.is-active { right: 0; }
.sp-nav ul { list-style: none; }
.sp-nav li { margin-bottom: 3.0rem; border-bottom: 0.1rem solid var(--border-color); padding-bottom: 1.0rem; }
.sp-nav a { font-size: 1.8rem; display: block; font-weight: 500; transition: all 0.3s ease; }

/* ★SPナビの現在地スタイル */
.sp-nav a.is-current {
  color: var(--primary-color);
  font-weight: 700;
  border-left: 0.3rem solid var(--primary-color);
  padding-left: 1.0rem;
}

/* ==========================================================================
   4. トップページ各セクション (PC版スタイル基準)
   ========================================================================== */
body.home main { padding-top: 8.0rem; }

/* ① ヒーロービュー */
.hero-view { position: relative; width: 100%; height: 65.0rem; overflow: hidden; background-color: #000000; }
.hero-media { width: 100%; height: 100%; }
.hero-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-text { position: absolute; bottom: 6.0rem; left: 6.0rem; background: rgba(255, 255, 255, 0.92); padding: 3.0rem 5.0rem; max-width: 65.0rem; box-shadow: 0 0.4rem 2.0rem rgba(0,0,0,0.05); z-index: 3; }
.hero-text h1 { font-size: 2.4rem; color: var(--primary-color); font-weight: 500; line-height: 1.6; letter-spacing: 0.05em; }

/* ② 新着情報 (NEWS) */
.news-list { list-style: none; border-top: 0.1rem solid var(--border-color); }
.news-item { display: flex; padding: 2.5rem 0; border-bottom: 0.1rem solid var(--border-color); align-items: center; }
.news-date { width: 16.0rem; font-size: 1.4rem; color: #888888; font-family: Arial, sans-serif; letter-spacing: 0.05em; }
.news-title { font-size: 1.6rem; flex: 1; }

/* 共通：右寄せボタン & 矢印アニメーション */
.services-more-btn, .about-more-btn, .partners-more-btn, .catalog-more-btn {
  display: block;
  text-align: right;
  margin-left: auto;
  font-size: 1.4rem;
  color: var(--primary-color);
  padding-bottom: 0.6rem;
  padding-right: 2.5rem;
  width: fit-content;
  position: relative;
  transition: all 0.3s ease;
}
.services-more-btn::after, .about-more-btn::after, .partners-more-btn::after, .catalog-more-btn::after { content: ""; position: absolute; bottom: 0; right: 0; width: 100%; height: 0.1rem; background-color: var(--primary-color); transition: width 0.3s ease; }
.services-more-btn::before, .about-more-btn::before, .partners-more-btn::before, .catalog-more-btn::before { content: "➔"; position: absolute; right: 0; bottom: 0.4rem; font-size: 1.1rem; transition: transform 0.3s ease; }
.services-more-btn:hover, .about-more-btn:hover, .partners-more-btn:hover, .catalog-more-btn:hover { color: #888888; }
.services-more-btn:hover::after, .about-more-btn:hover::after, .partners-more-btn:hover::after, .catalog-more-btn:hover::after { background-color: #888888; }
.services-more-btn:hover::before, .about-more-btn:hover::before, .partners-more-btn:hover::before, .catalog-more-btn:hover::before { transform: translateX(0.5rem); }

/* ③ 業務内容 (SERVICES) */
.services-section { background-color: #f5f7fa; }
.services-row-flex { display: flex; align-items: flex-start; justify-content: space-between; }

/* ★見出しを0.5文字分上にまたがらせる（-9.0rem） */
.services-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 0 0 15%;
  margin-top: -9.0rem;
  position: relative;
  z-index: 10;
}
.services-sub { font-family: 'Times New Roman', Times, serif; font-size: 1.4rem; letter-spacing: 0.2em; color: #cccccc; font-weight: 300; writing-mode: vertical-rl; text-transform: uppercase; line-height: 1; }

.services-container { flex: 0 0 80%; display: flex; flex-direction: column; align-items: flex-start; }
.services-img-box { width: 75%; max-width: 580px; box-shadow: 0 1.5rem 3.5rem rgba(26, 54, 93, 0.04); }
.services-img-box img { width: 100%; display: block; }

.services-content-box { width: 65%; max-width: 480px; background: #ffffff; padding: 3.5rem 4.0rem 0 4.0rem; margin-top: -5.0rem; margin-left: 6.0rem; z-index: 2; box-shadow: 0 1.5rem 3.0rem rgba(0, 0, 0, 0.02); }
.services-lead { font-size: 1.7rem; color: var(--primary-color); line-height: 1.6; font-weight: 400; margin-bottom: 1.5rem; letter-spacing: 0.05em; }
.services-description { font-size: 1.4rem; color: #666666; line-height: 1.7; font-weight: 300; margin-bottom: 3.0rem; }

/* ④ 会社概要 (ABOUT) - ★横長画像(1440x756)最適化版 */
.about-section { background-color: #ffffff; }
.about-row-flex { display: flex; align-items: flex-start; justify-content: space-between; }

/* ★見出しを0.5文字分上にまたがらせる（-9.0rem） */
.about-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 0 0 12%;
  margin-top: -9.0rem;
  position: relative;
  z-index: 10;
}
.about-sub { font-family: 'Times New Roman', Times, serif; font-size: 1.4rem; letter-spacing: 0.2em; color: #cccccc; font-weight: 300; writing-mode: vertical-rl; text-transform: uppercase; line-height: 1; }

.about-container { flex: 0 0 85%; display: flex; flex-direction: column; align-items: flex-start; }

/* 横長画像が綺麗に映えるよう、幅を拡大してバランスを調整 */
.about-img-box { width: 85%; max-width: 720px; box-shadow: 0 1.5rem 3.5rem rgba(26, 54, 93, 0.04); border-radius: 0.4rem; overflow: hidden; }
.about-img-box img { width: 100%; height: auto; display: block; object-fit: cover; }

/* 白ボックスの位置・余白調整（横長画像の下部に綺麗に重なる設定） */
.about-content-box {
  width: 70%;
  max-width: 520px;
  background: #ffffff;
  padding: 3.5rem 4.0rem;
  margin-top: -6.0rem;
  margin-left: 8.0rem;
  z-index: 2;
  box-shadow: 0 1.5rem 3.0rem rgba(0, 0, 0, 0.04);
  border-radius: 0.4rem;
}
.about-lead { font-size: 1.7rem; color: var(--primary-color); line-height: 1.7; font-weight: 400; margin-bottom: 0; letter-spacing: 0.05em; text-align: justify; }

/* ⑤ 取引先企業 (PARTNERS) */
.partners-section { background-color: #ffffff; }
.partners-flex { display: flex; align-items: flex-start; }

/* ★見出しを0.5文字分上にまたがらせる（-9.0rem） */
.partners-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 0 0 15%;
  margin-top: -9.0rem;
  position: relative;
  z-index: 10;
}
/* 最初から #cccccc (薄灰色) に固定し、スクロール時の色ぶれを防止 */
.partners-sub { font-family: 'Times New Roman', Times, serif; font-size: 1.4rem; letter-spacing: 0.2em; color: #cccccc; font-weight: 300; writing-mode: vertical-rl; text-transform: uppercase; line-height: 1; }

.partners-content-box { flex: 0 0 80%; padding-left: 0; padding-top: 0.5rem; }
.partners-genre-group { display: flex; flex-direction: column; gap: 3.5rem; margin-bottom: 4.0rem; }
.partners-genre-item { display: block; }
.genre-title { font-size: 1.6rem; font-weight: 500; color: var(--primary-color); border-left: 0.2rem solid var(--primary-color); padding-left: 1.2rem; line-height: 1; margin-bottom: 1.5rem; letter-spacing: 0.05em; }
.partners-sub-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem 3.0rem; list-style: none; }

.partners-sub-list li {
  font-size: 1.4rem;
  color: #555555;
  font-weight: 300;
  line-height: 1.4;
}
.partners-sub-list li a {
  display: inline-block;
  width: 100%;
  padding: 0.2rem 0;
  color: #555555;
  transition: all 0.3s ease;
}
/* ★取引先ホバー時：プライマリーカラーに変更＋右に5pxスライド */
.partners-sub-list li a:hover {
  color: var(--primary-color);
  transform: translateX(0.5rem);
  opacity: 1;
}

/* ⑥ 各種カタログ (CATALOG) */
.catalog-section { background-color: #ffffff; }
.catalog-flex { display: flex; align-items: flex-start; }

/* ★見出しを0.5文字分上にまたがらせる（-9.0rem） */
.catalog-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  flex: 0 0 15%;
  margin-top: -9.0rem;
  position: relative;
  z-index: 10;
}
.catalog-sub { font-family: 'Times New Roman', Times, serif; font-size: 1.4rem; letter-spacing: 0.2em; color: #cccccc; font-weight: 300; writing-mode: vertical-rl; text-transform: uppercase; line-height: 1; }

.catalog-content-box { flex: 0 0 80%; padding-left: 0; padding-top: 0.5rem; }
.catalog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.0rem; margin-bottom: 4.0rem; }
.catalog-item { background: #ffffff; border: 0.1rem solid #e4e4e7; padding: 2.2rem 2.0rem; text-align: center; font-size: 1.5rem; color: #333333; box-shadow: 0 0.2rem 1.0rem rgba(0, 0, 0, 0.02); display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; min-height: 7.0rem; }
.catalog-item:hover { background-color: #e4e4e7; border-color: #e4e4e7; color: #1a365d; opacity: 1; }

/* ⑦ お問い合わせ (CONTACT) */
.contact-section { background-color: var(--bg-light); text-align: center; }
.contact-section h2 { font-size: 2.6rem; color: var(--primary-color); font-weight: 500; letter-spacing: 0.15em; }
.contact-section p { font-size: 1.5rem; margin-top: 1.5rem; color: #444444; line-height: 1.7; display: inline-block; text-align: center; }
.btn-contact { display: inline-block; background-color: var(--accent-gray); color: #ffffff; font-size: 1.6rem; font-weight: 500; padding: 1.6rem 5.5rem; border-radius: 0.4rem; margin-top: 3.0rem; box-shadow: 0 0.4rem 1.0rem rgba(0,0,0,0.06); transition: all 0.3s ease; letter-spacing: 0.05em; }
.btn-contact:hover { background-color: #52525b; transform: translateY(-0.2rem); opacity: 1; }

/* ==========================================================================
   5. 共通フッター
   ========================================================================== */
.site-footer { background: #ffffff; padding: 6.0rem 0 4.0rem; border-top: 0.1rem solid var(--border-color); }
.footer-flex { display: flex; justify-content: space-between; gap: 4.0rem; align-items: flex-start; margin-bottom: 4.0rem; }
.footer-info { flex: 1.1; font-size: 1.5rem; color: #333333; line-height: 1.5; }
.branch-title { font-size: 1.6rem; margin-bottom: 0.5rem; }
.meta-space { margin-top: 0.8rem; }
.notice-text { font-size: 1.1rem; color: #666666; margin-top: 0.4rem; }
.footer-info a { text-decoration: underline; }
.footer-map { flex: 1.2; }
.footer-map iframe { width: 100%; height: 26.0rem; border: 0.2rem solid #1d3973; display: block; }
.footer-nav-wrapper { flex: 0.9; padding-left: 4.0rem; border-left: 0.1rem solid #cccccc; }
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: 2.0rem; }
.footer-nav a { font-size: 1.6rem; color: #333333; }
.footer-policy-nav { margin-top: 4.0rem; }
.footer-policy-nav ul { list-style: none; }
.footer-policy-nav li { margin-bottom: 1.0rem; }
.footer-policy-nav a { font-size: 1.2rem; color: #555555; }
.copyright { text-align: center; font-size: 1.3rem; color: #333333; margin-top: 4.0rem; font-family: "Times New Roman", Times, serif; letter-spacing: 0.05em; }

/* ==========================================================================
   6. 新規追加：全ページ共通の固定背景用のシステム設計（ズレ対策：inset導入版）
   ========================================================================== */
.bg-fixed-section {
  position: relative;
  z-index: 1;
}

/* 疑似要素で固定背景画面を完全に構築 */
.bg-fixed-section::before {
  content: "";
  position: fixed;
  /* top/left から inset に変更してブラウザ全体に最初からズレずに吸着させます */
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  background-image: none; /* 各個別ページの style タグ内で background-image を上書き適用します */
}

/* ==========================================================================
   7. レスポンシブ対応 (ブレイクポイント: 768px以下)
   ========================================================================== */
@media (max-width: 768px) {
  .pc-nav { display: none; }
  .burger-btn { display: block; }

  .header-container { padding: 0 2.0rem; }
  .section-padding { padding: 5.0rem 0; }

  .hero-view { height: 40.0rem; }
  .hero-text { left: 2.0rem; right: 2.0rem; bottom: 2.0rem; padding: 2.0rem; }
  .hero-text h1 { font-size: 1.8rem; }

  /* スマホ版・新着情報（NEWS）調整：日付とタイトルの間に余裕をもたせる */
  .news-item { padding: 1.8rem 0; }
  .news-item a { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .news-date { width: auto; font-size: 1.3rem; color: #777777; }
  .news-title { font-size: 1.5rem; line-height: 1.5; }

  /* スマホ版では横書きに変更し、サイズ調整 */
  .tate-title { writing-mode: horizontal-tb; font-size: 2.4rem; letter-spacing: 0.1em; padding-left: 0; margin-bottom: 0; }
  .section-img { width: 100%; height: 25.0rem; }

  /* スマホ版：見出しエリアを「縦並び」にし、英語の下に日本語が配置されるように変更 */
  .services-title-wrap, .about-title-wrap, .partners-title-wrap, .catalog-title-wrap {
    margin-top: 0 !important;
    margin-bottom: 2.0rem;
    flex: 0 0 100%;
    flex-direction: column; /* 縦並びにする */
    gap: 0.5rem;            /* 英語と日本語の間隔 */
  }

  /* 英語サブタイトルの横書き化とスタイルの微調整 */
  .services-sub, .about-sub, .partners-sub, .catalog-sub {
    writing-mode: horizontal-tb;
    display: block;
    line-height: 1.2;
  }

  /* スマホ版・業務内容調整 */
  .services-row-flex { flex-direction: column; }
  .services-container { flex: 0 0 100%; width: 100%; }
  .services-img-box { width: 100%; }
  .services-content-box { width: 100%; max-width: 100%; margin-left: 0; margin-top: -2.0rem; padding: 3.0rem 2.0rem; box-shadow: 0 1.0rem 2.0rem rgba(0,0,0,0.05); }
  .services-more-btn { margin-top: 2.0rem; }

  /* スマホ版・会社概要調整 */
  .about-row-flex { flex-direction: column; }
  .about-container { flex: 0 0 100%; width: 100%; }
  .about-img-box { width: 100%; border-radius: 0; }
  .about-content-box { width: 100%; max-width: 100%; margin-left: 0; margin-top: -2.0rem; padding: 3.0rem 2.0rem; box-shadow: 0 1.0rem 2.0rem rgba(0,0,0,0.05); border-radius: 0; }

  /* スマホ版・取引先企業調整 */
  .partners-flex { flex-direction: column; align-items: stretch; }
  .partners-content-box { padding-left: 0; }
  .partners-sub-list { grid-template-columns: 1fr; gap: 1.0rem; }
  .partners-more-btn { margin-top: 2.0rem; }
  .partners-sub-list li a:hover { transform: none; } /* スマホでの横ブレを防止 */

  /* スマホ版・各種カタログ調整 */
  .catalog-flex { flex-direction: column; align-items: stretch; }
  .catalog-content-box { padding-left: 0; }
  .catalog-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .catalog-item { min-height: 6.5rem; padding: 1.8rem 1.5rem; }
  .catalog-more-btn { margin-top: 2.0rem; }

  /* スマホ版・フッター調整 */
  .footer-flex { flex-direction: column; gap: 4.0rem; margin-bottom: 3.0rem; }
  .footer-map iframe { height: 25.0rem; }
  .footer-nav-wrapper { padding-left: 0; border-left: none; border-top: 0.1rem solid var(--border-color); padding-top: 3.0rem; width: 100%; }

  /* スマホ版・共通固定背景のサイズ微調整 */
  .bg-fixed-section::before {
    background-size: 75% auto;
  }
}

/* ==============================================
   ローディング画面
   ============================================== */

/* ローディング画面全体 */
#site-loader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  background-color: #ffffff; /* サイトの背景色 */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  /* 切り替わりを滑らかにするため 0.6s から 0.8s に調整 */
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

/* 読み込み完了後に消すクラス */
#site-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

/* ロゴのアニメーション設定 */
.loader-logo {
  /* 画面幅（vw）に基づいたレスポンシブサイズ */
  width: 40vw;
  min-width: 180px;
  max-width: 400px;
  height: auto;

  /* 時間を0.8秒にしてアニメーションを早く終わらせる */
  animation: logoPop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes logoPop {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}