:root {
  --primary-color: #4caf50;
  --text-color: #333;
  --white-color: #fff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: "Hiragino Kaku Gothic Pro", Meiryo, sans-serif;
  background-image: url("https://www.town.minamifurano.hokkaido.jp/wp-content/uploads/2024/03/bus_converted_01.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

/* ヘッダー */
#header-section {
  text-align: center;
  padding: 15px 10px 10px 10px;
}

#header-section h1 {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px 20px;
  border-radius: 8px;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* メインコンテンツ - 大画面では中央配置 */
#main-section {
  flex: 1;
  overflow-y: auto;
  padding: 0 15px 20px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* 大画面で中央配置 */
  text-align: center; /* すべてのコンテンツを中央揃え */
}

#route-map,
#timetable {
  width: 100%;
  max-width: 800px;
  margin-top: 25px;
  text-align: center; /* 中央揃え */
}

#route-map:first-child {
  margin-top: 0;
}

#route-map h2,
#timetable h2 {
  background-color: rgba(255, 255, 255, 0.9);
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: clamp(1.3rem, 4vw, 1.75rem);
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center; /* 中央揃え */
}

/* 路線リンク */
.route {
  margin: 12px 0;
  text-align: center; /* 中央揃え */
}

.route h3 {
  background-color: rgba(255, 255, 255, 0.9);
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center; /* 中央揃え */
}

.route h3 a {
  display: inline-block;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  padding: 8px 16px;
  min-height: 44px;
  line-height: 1.5;
}

/* リンクスタイル */
a {
  color: var(--text-color);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 5px;
  border: 2px solid var(--primary-color);
  transition: all 0.3s ease;
  display: inline-block;
}

a:hover,
a:focus {
  background-color: var(--primary-color);
  color: var(--white-color);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transform: translateY(-2px);
}

a:active {
  transform: translateY(0);
}

/* フッター */
#footer-section {
  background-color: rgba(51, 51, 51, 0.9);
  color: var(--white-color);
  font-size: clamp(0.875rem, 2.5vw, 1.125rem);
  padding: 15px 10px;
  width: 100%;
  text-align: center;
  flex-shrink: 0; /* フッターが縮まないように */
}

#footer-section p {
  margin: 5px 0;
  line-height: 1.6;
}

#footer-section p a.tel-link {
  color: #fff;
  text-decoration: none;
  border: none;
  padding: 4px 8px;
  background-color: transparent;
  box-shadow: none;
  transition: opacity 0.3s;
  font-weight: bold;
}

#footer-section p a.tel-link:hover,
#footer-section p a.tel-link:focus {
  background-color: transparent;
  color: #fff;
  text-decoration: underline;
  transform: none;
  opacity: 0.8;
}

/* タブレット・スマートフォン - 上寄せに変更 */
@media screen and (max-width: 768px) {
  #header-section {
    padding: 10px 10px 5px 10px;
  }

  #main-section {
    padding: 10px 10px 15px 10px;
    justify-content: flex-start; /* スマホでは上寄せ */
  }

  #route-map,
  #timetable {
    margin-top: 20px;
  }

  .route {
    margin: 10px 0;
  }
}

/* スマートフォン */
@media screen and (max-width: 480px) {
  #header-section {
    padding: 8px 5px 5px 5px;
  }

  #header-section h1 {
    padding: 12px 15px;
  }

  #main-section {
    padding: 8px 5px 12px 5px;
  }

  #route-map,
  #timetable {
    margin-top: 15px;
  }

  #route-map h2,
  #timetable h2 {
    padding: 10px 16px;
    margin-bottom: 12px;
  }

  .route {
    margin: 8px 0;
  }

  .route h3 {
    padding: 6px 12px;
  }

  .route h3 a {
    padding: 10px 14px;
  }

  #footer-section {
    padding: 12px 8px;
  }
}

/* 非常に小さい画面 */
@media screen and (max-width: 360px) {
  #header-section {
    padding: 5px 5px 3px 5px;
  }

  #header-section h1 {
    padding: 10px 12px;
  }

  #main-section {
    padding: 5px 5px 10px 5px;
  }

  a {
    padding: 6px 12px;
  }
}

/* 横向き対応 */
@media screen and (max-height: 500px) and (orientation: landscape) {
  body {
    background-attachment: scroll;
  }

  #header-section {
    padding: 5px 10px 3px 10px;
  }

  #main-section {
    padding: 8px 10px;
    justify-content: flex-start;
  }

  #route-map,
  #timetable {
    margin-top: 12px;
  }
}

/* 大画面用の追加調整 */
@media screen and (min-width: 1200px) {
  #main-section {
    padding-top: 0;
    padding-bottom: 30px;
  }
}
