/* ==========================================================================
   下層ページ共通スタイル
   ========================================================================== */

.subpage {
  padding: 100px 0 50px;
}

.breadcrumb {
  margin-bottom: 30px;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: #666;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: #333;
}

.breadcrumb span {
  margin: 0 5px;
  color: #999;
}

.page-header {
  text-align: center;
  margin-bottom: 50px;
}

.page-header h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 10px;
  font-family: 'Noto Serif JP', serif;
}

.page-subtitle {
  font-size: 1.2rem;
  color: #666;
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.page-content {
  max-width: 1000px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ==========================================================================
   事業内容ページ
   ========================================================================== */

.service-page .service-detail-section {
  margin-bottom: 50px;
}

.service-detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 60px;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
}

.service-detail-item:nth-child(even) {
  flex-direction: row-reverse;
}

.service-detail-image {
  flex: 1;
  margin-right: 30px;
}

.service-detail-item:nth-child(even) .service-detail-image {
  margin-right: 0;
  margin-left: 30px;
}

.service-detail-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.service-detail-content {
  flex: 1;
}

.service-detail-content h2 {
  font-size: 1.8rem;
  color: #333;
  margin-bottom: 20px;
  font-family: 'Noto Serif JP', serif;
}

.service-detail-content p {
  color: #666;
  line-height: 1.8;
}

/* ==========================================================================
   会社概要ページ
   ========================================================================== */

.about-page section {
  margin-bottom: 60px;
  padding: 0;
}

.about-page h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 30px;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
}

.company-info-image {
  text-align: center;
  margin-bottom: 30px;
}

.company-info-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.company-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.company-table th,
.company-table td {
  padding: 15px;
  border: 1px solid #ddd;
  text-align: left;
}

.company-table th {
  background: #f8f9fa;
  font-weight: bold;
  width: 150px;
}

.philosophy-content {
  display: flex;
  align-items: center;
  gap: 30px;
}

.philosophy-image {
  flex: 1;
}

.philosophy-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.philosophy-text {
  flex: 1;
}

.philosophy-text h3 {
  font-size: 1.5rem;
  color: #333;
  margin-bottom: 15px;
  font-family: 'Noto Serif JP', serif;
}

.philosophy-text ol {
  list-style: none;
  padding-left: 0;
  counter-reset: philosophy-counter;
}

.philosophy-text ol li {
  position: relative;
  padding-left: 2em;
  margin-bottom: 1em;
  line-height: 1.7;
}

.philosophy-text ol li::before {
  counter-increment: philosophy-counter;
  content: counter(philosophy-counter) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-weight: bold;
  color: #032596;
}

.clients-list ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  list-style: none;
  padding: 0;
}

.clients-list li {
  padding: 15px;
  background: #f8f9fa; /* 背景色を明るい色に変更 */
  border-radius: 8px;
  text-align: center;
  color: #333; /* テキスト色を明示的に指定 */
}

.history-timeline {
  position: relative;
  width: 100%;
  max-width: 1000px; /* コンテンツ幅に合わせて調整 */
  margin: 0 auto; /* 中央寄せ */
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  width: 2px;
  background: #032596;
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  width: 50%; /* 幅を半分に */
  box-sizing: border-box; /* paddingを含めて幅を計算 */
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 4px;
  width: 25px;
  height: 25px;
  background-image: url(../img/top/square00.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 1; /* ラインより手前に表示 */
}

/* 奇数番目（1, 3, 5...）のアイテムを右側に配置 */
.timeline-item:nth-child(odd) {
  margin-left: 50%;
  padding-left: 60px;
}

.timeline-item:nth-child(odd)::before {
  left: 0;
  transform: translateX(-50%);
}

/* 偶数番目（2, 4, 6...）のアイテムを左側に配置 */
.timeline-item:nth-child(even) {
  padding-right: 60px;
}

.timeline-item:nth-child(even)::before {
  right: 0;
  transform: translateX(50%);
}

/* マーカーとコンテンツをつなぐ点線 */
.timeline-item::after {
  content: '';
  position: absolute;
  top: 16px; /* マーカーの中心 */
  width: 40px; /* 線の長さ */
  height: 3px; /* 線の太さ */
  background: repeating-linear-gradient(
    to right,
    #032596 0 4px,     /* 点の長さ */
    transparent 2px 5px /* 隙間の長さ */
  );
}

.timeline-item:nth-child(odd)::after {
  left: 10px; /* マーカーの右からの距離 */
}

.timeline-item:nth-child(even)::after {
  right: 10px; /* マーカーの左からの距離 */
  width: 350px; /* 偶数番目の線の長さを変更 */
}

.timeline-year {
  font-size: 1.2rem;
  font-weight: bold;
  color: #000;
  margin-bottom: 10px;
}

.timeline-content h3 {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 10px;
  font-family: 'Noto Serif JP', serif;
}

/* ==========================================================================
   お問い合わせページ
   ========================================================================== */

.contact-page section {
  margin-bottom: 50px;
}

.contact-page h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 30px;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
}

.contact-intro {
  text-align: center;
  margin-bottom: 50px;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
}

.contact-form-wrapper {
  max-width: 600px;
  margin: 0 auto;
}

.contact-info-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.contact-info-item {
  text-align: center;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
}

.contact-info-item h3 {
  font-size: 1.3rem;
  color: #333;
  margin-bottom: 15px;
  font-family: 'Noto Serif JP', serif;
}

.map-placeholder {
  text-align: center;
}

.map-placeholder img {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: 8px;
}

/* ==========================================================================
   採用情報ページ
   ========================================================================== */

.recruit-page section {
  margin-bottom: 50px;
}

.recruit-page h2 {
  font-size: 2rem;
  color: #333;
  margin-bottom: 30px;
  text-align: center;
  font-family: 'Noto Serif JP', serif;
}

.recruit-status {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 50px;
}

.recruit-status-image {
  flex: 1;
}

.recruit-status-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.recruit-status-content {
  flex: 1;
}

.recruit-notice {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  padding: 30px;
  border-radius: 8px;
  margin-top: 20px;
}

.recruit-notice p:first-child {
  font-size: 1.2rem;
  font-weight: bold;
  color: #856404;
  margin-bottom: 15px;
}

.recruit-future{
  text-align: center;
}

/* ==========================================================================
   投稿詳細ページ
   ========================================================================== */

.single-page .single-article {
  max-width: 800px;
  margin: 0 auto;
}

.article-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 1px solid #eee;
}

.article-header h1 {
  font-size: 2.2rem;
  color: #333;
  margin-bottom: 20px;
  font-family: 'Noto Serif JP', serif;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  color: #666;
  font-size: 0.9rem;
}

.article-content {
  margin-bottom: 40px;
}

.article-footer {
  padding-top: 30px;
  border-top: 1px solid #eee;
  margin-bottom: 40px;
}

.article-tags {
  font-size: 0.9rem;
  color: #666;
}

.tags-label {
  font-weight: bold;
  margin-right: 10px;
}

.article-navigation {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #eee;
  padding-top: 30px;
}

.article-navigation a {
  color: #007bff;
  text-decoration: none;
  font-size: 0.9rem;
}

.article-navigation a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   アーカイブページ
   ========================================================================== */

.archive-page .archive-posts {
  margin-bottom: 50px;
}

.archive-post-item {
  border-bottom: 1px solid #eee;
  padding-bottom: 30px;
  margin-bottom: 30px;
}

.archive-post-item:last-child {
  border-bottom: none;
}

.post-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  font-size: 0.9rem;
  color: #666;
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.post-title a {
  color: #333;
  text-decoration: none;
  font-family: 'Noto Serif JP', serif;
}

.post-title a:hover {
  color: #007bff;
}

.post-excerpt {
  color: #666;
  line-height: 1.8;
  margin-bottom: 15px;
}

.read-more-link {
  color: #007bff;
  text-decoration: none;
  font-weight: bold;
}

.read-more-link:hover {
  text-decoration: underline;
}

.pagination {
  text-align: center;
  margin-top: 50px;
}

.pagination a {
  color: #007bff;
  text-decoration: none;
  padding: 10px 20px;
  margin: 0 5px;
  border: 1px solid #007bff;
  border-radius: 4px;
}

.pagination a:hover {
  background: #007bff;
  color: white;
}

/* ==========================================================================
   404エラーページ
   ========================================================================== */

.error-page .error-content {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 50px;
}

.error-image {
  flex: 1;
}

.error-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.error-text {
  flex: 1;
}

.error-text p:first-child {
  font-size: 1.2rem;
  font-weight: bold;
  color: #dc3545;
  margin-bottom: 15px;
}

.error-navigation {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 50px;
}

.error-nav-item .btn {
  display: inline-block;
  padding: 12px 30px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s;
}

.error-nav-item .btn:hover {
  background: #0056b3;
}

.error-search {
  text-align: center;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
}

.error-search h2 {
  font-size: 1.5rem;
  color: #333;
  margin-bottom: 20px;
  font-family: 'Noto Serif JP', serif;
}

.no-posts {
  text-align: center;
  padding: 50px;
  color: #666;
}

/* ==========================================================================
   アニメーション・動的効果
   ========================================================================== */

/* ページ読み込み時のアニメーション */
body {
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.page-loaded {
  opacity: 1;
}

/* フェードインアニメーション */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* スライドアニメーション */
.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide-in-left.animate-slide {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.slide-in-right.animate-slide {
  opacity: 1;
  transform: translateX(0);
}

/* タイムラインアニメーション */
.timeline-item {
  opacity: 0;
  transform: translateX(-30px); /* デフォルトは左から（偶数番目） */
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item:nth-child(odd) {
  transform: translateX(30px); /* 奇数番目は右から */
}

.timeline-item.animate-timeline {
  opacity: 1;
  transform: translateX(0);
}

/* ホバー効果 */
.service-detail-item {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-detail-item.hover-effect {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.service-detail-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* 画像ホバー効果 */
.service-detail-image img,
.company-info-image img,
.philosophy-image img,
.culture-image img,
.error-image img {
  transition: transform 0.3s ease, filter 0.3s ease;
}

.service-detail-image img:hover,
.company-info-image img:hover,
.philosophy-image img:hover,
.culture-image img:hover,
.error-image img:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

/* ボタンのリップル効果 */
.btn,
.read-more-link {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn:hover,
.read-more-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* テキストアニメーション */
.text-animation {
  overflow: hidden;
}

.char-animation {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: char-fade-in 0.6s ease forwards;
}

@keyframes char-fade-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* カウントアップ数字 */
.count-up {
  font-weight: bold;
  color: #007bff;
  transition: color 0.3s ease;
}

/* パララックス要素 */
.parallax-element {
  will-change: transform;
}

/* スクロール進捗バー */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, #007bff, #28a745);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* 画像モーダル */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  cursor: default;
}

.modal-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 1);
}

/* 画像レイジーロード */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img.loaded {
  opacity: 1;
}

/* フォームアニメーション */
.form-group {
  position: relative;
  margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 15px 15px 15px 15px;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  transition: border-color 0.3s ease;
  background: transparent;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #007bff;
}

.form-group label {
  position: absolute;
  top: 15px;
  left: 15px;
  color: #666;
  font-size: 16px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.form-group.focused label {
  top: -10px;
  left: 10px;
  font-size: 12px;
  color: #007bff;
  background: white;
  padding: 0 5px;
}

/* 会社情報テーブルのアニメーション */
.company-table tr {
  transition: background-color 0.3s ease;
}

.company-table tr:hover {
  background-color: #f8f9fa;
}

/* 取引先リストのアニメーション */
.clients-list li {
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.clients-list li:hover {
  transform: translateY(-3px);
  background-color: #e9ecef;
}

/* ページネーションのアニメーション */
.pagination a {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.pagination a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.pagination a:hover::before {
  left: 100%;
}

/* 検索フォームのアニメーション */
.search-form input[type="search"] {
  transition: all 0.3s ease;
  border-radius: 25px;
  padding: 10px 20px;
  border: 2px solid #ddd;
}

.search-form input[type="search"]:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
  outline: none;
}

/* パンくずリストのアニメーション */
.breadcrumb-nav {
  animation: breadcrumb-slide-in 0.6s ease;
}

@keyframes breadcrumb-slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ページヘッダーのアニメーション */
.page-header {
  animation: header-fade-in 0.8s ease;
}

@keyframes header-fade-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* エラーページのアニメーション */
.error-nav-item {
  transition: transform 0.3s ease;
}

.error-nav-item:hover {
  transform: scale(1.05);
}

/* スクロールアニメーション用のクラス */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   レスポンシブデザイン
   ========================================================================== */

@media (max-width: 768px) {
  .subpage {
    padding: 80px 0 30px;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .service-detail-item {
    flex-direction: column;
    text-align: center;
  }

  .service-detail-item:nth-child(even) {
    flex-direction: column;
  }

  .service-detail-image {
    margin-right: 0;
    margin-bottom: 20px;
  }

  .service-detail-item:nth-child(even) .service-detail-image {
    margin-left: 0;
    margin-bottom: 20px;
  }

  .philosophy-content {
    flex-direction: column;
  }

  .recruit-status {
    flex-direction: column;
  }

  .culture-content {
    flex-direction: column;
  }

  .error-content {
    flex-direction: column;
  }

  .error-navigation {
    flex-direction: column;
    align-items: center;
  }

  .article-navigation {
    flex-direction: column;
    gap: 20px;
  }

  .company-table th {
    width: 120px;
  }

  .company-table th,
  .company-table td {
    padding: 10px;
    font-size: 0.9rem;
  }

  .clients-list ul {
    grid-template-columns: 1fr;
  }

  .contact-info-content {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    margin-bottom: 30px;
  }

  .timeline-year {
    font-size: 1.1rem;
  }

  .timeline-content h3 {
    font-size: 1.2rem;
  }

  /* タイムラインのレスポンシブ対応 */
  .history-timeline {
    padding-left: 0; /* PC用のpaddingをリセット */
    width: 90%; /* コンテナ幅に合わせる */
  }

  .history-timeline::before {
    left: 10px; /* 縦線を左端に寄せる */
    transform: none;
  }

  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding-left: 50px; /* マーカーと線のスペースを確保 */
    padding-right: 0;
    text-align: left !important; /* 全て左寄せに統一 */
  }

  .timeline-item::before,
  .timeline-item:nth-child(odd)::before,
  .timeline-item:nth-child(even)::before {
    left: 5px; /* マーカーの位置を調整 (10px - 12px/2) */
    right: auto;
    transform: rotate(45deg); /* 回転のみ */
  }

  .timeline-item::after,
  .timeline-item:nth-child(odd)::after,
  .timeline-item:nth-child(even)::after {
    left: 20px; /* 点線の開始位置 */
    right: auto;
    width: 20px; /* スマホ用に線の長さを短く統一 */
  }

  /* アニメーションもすべて左からに統一 */
  .timeline-item:nth-child(odd) {
    /* PCで設定した右からのアニメーションを上書き */
    transform: translateX(0px);
  }
}