@import url("https://fonts.googleapis.com/css?family=Exo+2:400,700&subset=cyrillic");
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

html {
  box-sizing: border-box;
  scroll-behavior: smooth;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, "Exo 2", sans-serif;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  position: relative;
}

/* 背景画像（最下層） */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/background.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: sepia(0.1) brightness(1.05) contrast(0.95);
  z-index: -3;
  pointer-events: none;
}

/* 背景オーバーレイ（白半透明） */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  z-index: -2;
  pointer-events: none;
}



/* スマホ用背景調整 - より引きにする */
@media (max-width: 600px) {
  body::before {
    background-attachment: scroll;
background-size: 100% 100%
/*     background-size: cover; */
    transform: scale(0.5); /* 1.2から0.5に変更 - 等倍で引きの効果 */
  }
  
  body::after {
    background: rgba(255, 255, 255, 0.7);
  }
}



/* コンテンツ背景：透明 */
.top-section,
.wrapper,
.timeline__section {
  background: transparent !important;
}

/* ナビゲーションコンテナ */
.fixed-nav-container {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* PC・スマホ共通のメインヘッダー */
.main-header {
  height: 60px;
}

.main-menu ul {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  list-style: none;
  gap: 20px;
}

.main-menu a {
  display: block;
  padding: 16px 0;
  font-weight: bold;
  color: #333;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  font-size: 15px;
}

.main-menu a:hover {
  color: #00a1e9;
}

/* PC用タイムラインナビ */
.timeline__nav-pc {
  position: fixed;
  top: 120px;
  left: calc(50% - 490px - 120px);
  width: 100px;
  z-index: 900;
}

.timeline__nav-pc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline__nav-pc li a {
  display: block;
  padding: 8px 0;
  text-align: center;
  text-decoration: none;
  color: #666;
  font-weight: bold;
  font-size: 14px;
  transition: color 0.2s;
}

.timeline__nav-pc li a:hover,
.timeline__nav-pc li.active a {
  color: #00a1e9;
}

/* スマホ用タイムラインナビ（初期非表示） */
.timeline__nav-mobile {
  display: none;
}

/* トップセクション */
.top-section {
  padding-top: 60px;
  padding-bottom: 80px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-logo-container {
  padding-top: 20px;
  text-align: center;
}

.city-logo {
  width: 100%;
  max-width: 60px;
  height: auto;
}

.header-text-container {
  padding: 10px 0;
  text-align: center;
}

.header-text-container h4 {
  font-size: 1.7em;
  margin: 0;
}

.header-text-container span {
  display: block;
  font-size: 1.1em;
  opacity: 0.7;
}

.header-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  width: 90%;
  max-width: 980px;
  margin-top: 20px;
  gap: 20px;
}

.header-left {
  width: 40%;
  text-align: center;
}

.anniversary-logo {
  width: 80%;
  max-width: 300px;
  height: auto;
  margin-left: 30px;
}

.header-right {
  width: 60%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mayor-photo {
  width: 100%;
  max-width: 200px;
  height: auto;
  margin-bottom: 15px;
}

.greeting-box {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 100%;
  box-shadow: none;
  border: none;
}

.greeting-box h3 {
  margin-top: 0;
  border-bottom: 2px solid #00a1e9;
  padding-bottom: 5px;
}

.mayor-signature {
  text-align: right;
  margin-top: 15px;
}

.mayor-signature p {
  margin: 0;
  line-height: 1.2;
}

.furigana {
  font-size: 0.8em;
  opacity: 0.8;
}

/* 年表ラッパー */
.wrapper {
  margin: 0 auto;
  padding: 0 16.66% 50px;
  width: 100%;
  position: relative;
  z-index: 1;
}

article {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
}

.timeline__section {
  padding-left: 0;
  position: relative;
  z-index: 1;
}

/* PC用サイドナビ領域確保 */
@media (min-width: 1200px) {
  .wrapper {
    padding: 0 50px 50px 200px;
  }
}

/* トップに戻るボタン */
.pagetop {
  height: 50px;
  width: 50px;
  position: fixed;
  right: 30px;
  bottom: 30px;
  background: #fff;
  border: solid 2px #000;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  cursor: pointer;
  transition: box-shadow 0.2s;
  box-shadow: 0 4px 6px rgb(0 0 0 / 15%);
}

.pagetop__arrow {
  height: 14px;
  width: 14px;
  border-top: 3px solid #000;
  border-right: 3px solid #000;
  transform: translateY(20%) rotate(-45deg);
}

@media (hover: hover) and (pointer: fine) {
  .pagetop:hover,
  .pagetop:hover .pagetop__arrow {
    border-color: #3293e7;
  }
}

/* 写真グリッド（PCは4列、スマホは2列） */
.timeline-photos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
}

/* PC用：4列 */
@media (min-width: 601px) {
  .timeline-photo {
    width: calc(25% - 15px); /* 4列 + ギャップ考慮 */
    height: auto;
    border: 3px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
  }
}

/* スマホ用：2列 */
@media (max-width: 600px) {
  .timeline-photo {
    width: calc(50% - 7.5px);
    height: auto;
    border: 3px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
  }
}

.timeline-photo:hover {
  transform: scale(1.03);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ポップアップ（JSのfadeIn/fadeOut対応） */
#photoPopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  padding: 20px;
  overflow-y: auto; /* 追加：コンテンツが長くてもスクロール可能 */
  overscroll-behavior: contain;
}






/* ポップアップ（JSのfadeIn/fadeOut対応） */
#photoPopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  padding: 20px;
  overflow-y: auto; /* 長い画像でもスクロール可能 */
  overscroll-behavior: contain;
  align-items: flex-start; /* コンテンツを上揃え */
}




/* ポップアップコンテンツ */
#photoPopup .popup-content {
  position: relative;
  max-width: 95vw;
  margin: 100px auto 40px; /* ← 80px → 100px に（Androidで上すぎるので下げる） */
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
  backdrop-filter: blur(2px);
  max-height: none;
}



/* 閉じるボタン —— Android考慮で少し下げる */
#photoPopup .close-btn {
  position: fixed;
  top: 30px;     /* ← 20px → 30px に（少し下げる） */
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0; /* テキスト非表示（二重防止） */
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2002;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  margin: 0;
  border: none;
  line-height: 1;
}




/* ✕ は ::before で1つだけ表示（二重防止の核心） */
#photoPopup .close-btn::before {
  content: "\00D7";
  font-size: 30px;
  display: block;
  color: white;
}



/* タップ領域拡大 */
#photoPopup .close-btn::after {
  content: '';
  position: absolute;
  top: -15px;
  left: -15px;
  right: -15px;
  bottom: -15px;
}

#photoPopup .close-btn:hover,
#photoPopup .close-btn:focus {
  background: rgba(0, 0, 0, 0.9);
  outline: none;
}




/* キャプション */
#photoPopup .photo-caption {
  color: #333;
  padding: 15px 5px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  max-width: 100%;
  margin: 10px 0 0 0;
}

/* 年号 */
.year-with-era {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  margin: 1em 0;
  color: #333;
}

.year-with-era .era {
  font-size: 0.7em;
  opacity: 0.8;
}

/* 日付と文章 */
.milestone p {
  display: flex;
  align-items: baseline;
  margin: 0.5em 0;
}

.event-date {
  display: inline-block;
  min-width: 5.5em;
  text-align: right;
  white-space: nowrap;
  color: #333;
}

.event-text {
  flex-grow: 1;
  padding-left: 1em;
  color: #333;
}

/* スクロール位置 */
.milestone,
.anchor-offset {
  scroll-margin-top: 120px;
}

/* 年表アイテム（透過感あり） */
.milestone {
  background: rgba(255, 255, 255, 0.7); /* ← 透過感復活！ */
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
  color: #333;
  backdrop-filter: blur(2px); /* 背景画像をぼかして読みやすく */
  border: 1px solid rgba(255, 255, 255, 0.3); /* 軽い枠線で浮かび上がらせる */
}

/* アニメーション */
.animated-container {
  display: block;
  margin-top: -1em;
}

.animated-text {
  opacity: 0;
  animation: fadeIn 2s forwards;
  font-family: 'Noto Sans JP', sans-serif;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* メディアクエリ（中間サイズ） */
@media (min-width: 601px) and (max-width: 1199px) {
  .timeline__nav-pc {
    left: 20px;
  }
}





/* レスポンシブ（スマホ用） */
@media (max-width: 600px) {
  .main-header {
    height: 60px;
  }

  .main-menu ul {
    justify-content: space-around;
    gap: 0;
  }

  .main-menu a {
    padding: 12px 0;
    font-size: 14px;
  }

  .timeline__nav-pc {
    display: none;
  }

  .timeline__nav-mobile {
    display: block;
    width: 100%;
    height: 40px;
    background-color: #f8f8f8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid #eee;
  }

  .timeline__nav-mobile::-webkit-scrollbar {
    height: 5px;
  }

  .timeline__nav-mobile::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
  }

  .timeline__nav-mobile ul {
    display: flex;
    flex-direction: row;
    padding: 0 20px;
    height: 100%;
    align-items: center;
    margin: 0;
    gap: 8px;
    list-style: none;
  }

  .timeline__nav-mobile ul li {
    flex-shrink: 0;
    padding: 5px 8px;
    font-size: 14px;
  }

  .timeline__nav-mobile ul li a {
    color: #666;
    text-decoration: none;
    font-weight: normal;
  }

  .timeline__nav-mobile ul li.active a {
    color: #00a1e9;
    font-weight: bold;
  }

  .top-section {
    padding-top: 100px;
    padding-bottom: 20px;
    padding-left: 2vw;
    padding-right: 2vw;
  }

  .wrapper {
    padding-left: 2vw;
    padding-right: 2vw;
    padding-top: 20px;
  }

  .milestone,
  .anchor-offset {
    scroll-margin-top: 100px;
  }

  .header-content {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .header-left,
  .header-right {
    width: 100%;
    text-align: center;
  }

  .header-right {
    order: 3;
  }

  .city-logo {
    max-width: 50px;
  }

  .anniversary-logo {
    margin: 0;
    max-width: 200px;
  }

  .mayor-photo {
    max-width: 100px;
  }

  .greeting-box {
    max-width: 100%;
    text-align: left;
  }





/* スマホ用年表：白枠・影・角丸を完全に削除（最終版） */
  .milestone {
    background: rgba(255, 255, 255, 0.1) !important; /* より薄く */
    padding: 15px !important;
    margin-bottom: 20px !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important; /* ← 影を完全に削除（重要！） */
    backdrop-filter: blur(1px) !important;
    -webkit-box-shadow: none !important; /* iOS/Safari用 */
    -moz-box-shadow: none !important;    /* Firefox用（念のため） */
  }






/* 横スクロール防止 */
html,
body {
  overflow-x: hidden;
  width: 100%;
}

img,
.timeline-photo,
.timeline-photos {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

/* スマホ高さ確保 */
@media (max-width: 600px) {
  html,
  body {
    min-height: 100vh;
  }
}

/* 年表中央寄せ（PC） */
@media screen and (min-width: 1024px) {
  .timeline__section {
    margin-left: 80px;
    max-width: 900px;
  }
}


/* 袋井市 市歌 */
#music-container {
  position: fixed;
  top: 70px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  z-index: 1000;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.music-label {
  font-size: 10px;
  color: #333;
  white-space: nowrap;
  font-weight: bold;
  opacity: 0.8;
}

.music-btn {
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background-color: #28a745; /* 初期OFFは緑 */
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

#music-volume {
  width: 120px;
}

/* スマホ用 */
@media screen and (max-width: 767px) {
  #music-container {
    top: 110px;
    right: 10px;     
  }
  
  .music-label {
    font-size: 9px;
  }
  
  .music-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  #music-volume {
    width: 80px;
  }
}


/* --- スマートフォン写真サイズ調整・縦並び --- */
@media screen and (max-width: 767px) {
  /* タイムライン写真の基本サイズを拡大（ウィンドウ画像相当：幅90vwまで） */
  .timeline-photo {
    width: 90vw !important;
    max-width: 400px !important; /* お好みでサイズ指定可 */
    display: block !important;
    margin: 0 auto 16px auto !important;
  }
  /* 2枚以上の写真もすべて縦並び（flex-row解除） */
  .timeline-photos {
    display: block !important;
  }
}





/* --- パソコン用 写真サイズ115%拡大 --- */
@media screen and (min-width: 768px) {
  .timeline-photo {
    width: 115% !important;
    max-width: none !important; /* 必要に応じて調整してください */
    /* 「width: 115%」は親要素に対して拡大表示 */
  }
}





