/* 全体レイアウト */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f7f5f0;
  background:
    linear-gradient(#05070b, #0b1115 40%, #05070b 100%),
    radial-gradient(circle at 20% 0%, rgba(60, 90, 50, 0.6), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(50, 80, 90, 0.6), transparent 60%);
  background-blend-mode: overlay;
  min-height: 100vh;
  overflow-x: hidden;
}

.forest-wrap {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 16px 80px;
}

/* タイトル */
.site-title {
  text-align: center;
  margin-bottom: 32px;
}

.site-title h1 {
  font-size: 1.8rem;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
}

.site-title p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

.site-title-home {
  margin-top: 8px;
  font-size: 0.8rem;
}

.site-title-home a {
  color: #e2ffdd;
  text-decoration: none;
  border-bottom: 1px dotted rgba(226, 255, 221, 0.7);
}

.site-title-home a:hover {
  border-bottom-style: solid;
}

/* 幹（縦の軸） */
.trunk {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    rgba(180, 210, 190, 0.2),
    rgba(140, 180, 150, 0.7),
    rgba(60, 90, 70, 0.5)
  );
  box-shadow: 0 0 18px rgba(180, 240, 200, 0.25);
  pointer-events: none;
}

/* セクション（ひらけた場所） */
.forest-node {
  position: relative;
  margin: 64px 0;
  padding: 24px 16px 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.04), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(255, 255, 255, 0.03), transparent 55%),
    rgba(10, 18, 15, 0.78);
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(120, 180, 140, 0.1);
  backdrop-filter: blur(3px);
}

/* 幹との接続ライン */
.forest-node::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 70px;
  height: 2px;
  background: linear-gradient(
    to right,
    rgba(160, 210, 180, 0.6),
    rgba(160, 210, 180, 0)
  );
}

/* ノードを左右に交互配置 */
.forest-node.left {
  margin-right: 20%;
  padding-right: 24px;
}

.forest-node.left::before {
  right: -70px;
}

.forest-node.right {
  margin-left: 20%;
  padding-left: 24px;
}

.forest-node.right::before {
  left: -70px;
  transform: scaleX(-1);
}

@media (max-width: 768px) {
  .forest-node,
  .forest-node.left,
  .forest-node.right {
    margin: 40px 0;
    padding: 20px 14px;
  }

  .forest-node::before {
    display: none; /* モバイルは線を簡略化 */
  }

  .trunk {
    opacity: 0.4;
  }
}

/* 見出しなど */
.node-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.node-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

.node-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.node-desc {
  font-size: 0.86rem;
  opacity: 0.9;
  line-height: 1.7;
  margin-bottom: 14px;
}

/* 枝（個別ページリンク） */
.node-branches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.branch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-decoration: none;
  color: #f7f5f0;
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.12), transparent 55%),
    rgba(30, 50, 40, 0.88);
  border: 1px solid rgba(190, 230, 200, 0.4);
  box-shadow: 0 0 10px rgba(120, 200, 150, 0.25);
  transition:
    transform 0.18s ease-out,
    box-shadow 0.18s ease-out,
    border-color 0.18s ease-out,
    background 0.18s ease-out;
}

.branch::before {
  content: "●";
  font-size: 0.5rem;
  opacity: 0.8;
}

.branch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(160, 230, 190, 0.45);
  border-color: rgba(220, 255, 230, 0.9);
  background:
    radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.2), transparent 60%),
    rgba(45, 70, 55, 0.98);
}

.branch span {
  opacity: 0.9;
}

/* ほたる */
.firefly {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 255, 200, 0.9), transparent);
  opacity: 0.7;
  pointer-events: none;
  animation: drift 18s linear infinite;
}

.firefly:nth-of-type(1) { top: 12%; left: 10%; animation-duration: 20s; }
.firefly:nth-of-type(2) { top: 30%; right: 12%; animation-duration: 24s; }
.firefly:nth-of-type(3) { top: 60%; left: 18%; animation-duration: 22s; }
.firefly:nth-of-type(4) { top: 80%; right: 20%; animation-duration: 26s; }

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0); opacity: 0.7; }
  25%  { transform: translate3d(20px, -10px, 0); opacity: 1; }
  50%  { transform: translate3d(-10px, 10px, 0); opacity: 0.6; }
  75%  { transform: translate3d(15px, 5px, 0); opacity: 0.9; }
  100% { transform: translate3d(0, 0, 0); opacity: 0.7; }
}

/* フッター */
.forest-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.7;
}
/* トップに戻るボタン */
.back-to-top {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(40, 65, 55, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8ffe0;
  text-decoration: none;
  font-size: 1.4rem;
  border: 1px solid rgba(200, 255, 220, 0.4);
  box-shadow: 0 0 10px rgba(140, 220, 160, 0.25);
  z-index: 999;
  transition: 
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.back-to-top:hover {
  transform: scale(1.05);
  background: rgba(55, 90, 70, 0.9);
  border-color: rgba(230, 255, 240, 0.9);
  box-shadow: 0 0 16px rgba(180, 255, 210, 0.55);
}
