/* ============================================
   ベースリセット・グローバル
============================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}


html > body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--c-text);
  background-color: var(--c-bg);
  min-height: 100vh;
  line-height: 1.75;
  letter-spacing: 0.02em;
  overflow-x: hidden;
}

.flex-r {
  display: flex;
  gap: 2%;
}

.flex-c {
  display: flex;
  flex-direction: column;
}

/* ============================================
   ヘッダー
============================================ */
header {
  background: var(--grad-header);
  border-bottom: 2px solid var(--c-primary);
  padding: 0 16px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--sh-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

h1.header-title {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: auto;
  font-size: 20px;
  letter-spacing: 0.05em;
  margin: 0;
  pointer-events: none;
  white-space: nowrap;
  color: var(--c-heading);
}

.header-title a {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--c-heading);
  text-decoration: none;
  transition: color var(--t-fast);
  pointer-events: auto;
}

.header-title a:hover { color: var(--c-primary-dk); }

.attention {
  background: var(--c-surface);
  border-bottom: 1.5px solid var(--c-border);
  padding: 7px 16px;
  text-align: center;
}

.attention p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--c-heading);
  letter-spacing: 0.02em;
}

.attention,
.attention > p,
.disclaimer {
  font-family: "NotoSerifJP", sans-serif;
}

/* ============================================
   ハンバーガーボタン（スマホ用）
============================================ */
.hamburger-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 2px solid var(--c-primary-dk);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.hamburger-btn:hover { background: rgba(168,218,181,0.3); }

.hamburger-btn .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--c-heading);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
}

/* ハンバーガー open アニメ */
.hamburger-btn.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open .bar:nth-child(2) { opacity: 0; }
.hamburger-btn.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
   メインレイアウト骨格（main.flex-r / .inner）
   ※ .flex-r ユーティリティ本体は equip-simulate.css 側
   ※ ホームページ（main:not(.flex-r)）用の上書きは home.css 側
============================================ */
main.flex-r {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 12px;
  max-width: 1300px;
  margin: 0 auto;
}

.inner {
  flex: 1;
  min-width: 0;
  width: 777px;
  max-width: 100%;
}

/* ============================================
   フッター
============================================ */
footer {
  background: var(--c-bg-soft);
  border-top: 2px solid var(--c-border);
  padding: 16px 24px;
  margin-top: 24px;
}

footer > div {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--c-heading);
}

.disclaimer {
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--c-heading);
  max-width: 720px;
  margin: 0 auto 12px;
  padding: 0 12px;
  white-space: nowrap;
}

footer a {
  color: var(--c-heading);
  text-decoration: none;
  transition: color var(--t-fast);
}

footer a:hover {
  color: var(--c-primary-dk);
  text-decoration: underline;
}

br.br-sp {
  display: none;
}

/* ============================================
   右サイドバー（ページ内ジャンプ／ボトムナビ構造）
   ※ アイコンの色（.custom-icon）は equip 専用装飾のため
     equip-simulate.css 側に分離
============================================ */
.right {
  width: 60px;
  flex-shrink: 0;
  position: sticky;
  top: 66px;
}

.right > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.right > div > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
  cursor: pointer;
  width: 100%;
}

.right > div > div:hover { background: var(--c-bg-soft); }

.right a {
  font-size: 12px;
  color: var(--c-muted);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  width: 100%;
}

.right a:hover { color: var(--c-primary-dk); }

.right i {
  font-size: 17px;
  color: var(--c-muted);
  transition: color var(--t-fast);
}

.right > div > svg:hover .custom-icon,
.right > div > div:hover i { color: var(--c-primary-text); }

/* ============================================
   タブレット／スマホ共通（～1024px）
   右サイドバー → ボトムナビゲーション化
============================================ */
@media (max-width: 1024px) {

  /* ボトムナビ分の余白を確保（タブレット/スマホ共通） */
  main.flex-r {
    padding-bottom: 80px;
  }

  /* --- 右サイドバー → ボトムナビゲーション --- */
  .right {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 58px;
    background: var(--c-surface);
    border-top: 2px solid var(--c-border);
    box-shadow: 0 -3px 14px rgba(80,160,110,0.12);
    z-index: 900;
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
    top: auto; /* sticky 解除 */
    /* iOS セーフエリア対応 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .right > div {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 0;
    padding: 0 4px;
  }

  .right > div > div {
    flex: 1;
    justify-content: center;
    align-items: center;
    width: auto;
    min-width: 0;
    padding: 4px 2px;
    height: 100%;
    gap: 2px;
  }

  .right a {
    font-size: 12px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    width: 100%;
  }

  .right i { font-size: 18px; }

  footer > div {
    padding-bottom: 58px;
  }

  br.br-sp {
    display: inline;
  }

  /* iOS セーフエリア分メインの下余白も調整 */
  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    main.flex-r {
      padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
  }
}

/* ============================================
   タブレット（769px ～ 1024px）
============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  main.flex-r { gap: 8px; padding: 12px 8px; }
  .inner      { flex: 1; width: auto; }
}

/* ============================================
   スマホ（～768px）
============================================ */
@media (max-width: 768px) {
  .header-title a {
    left: 50%;
    transform: translate(-50%, -50%);
  }

  /* --- ハンバーガーボタン表示 --- */
  .hamburger-btn { display: flex; }

  .attention {
    padding: 6px 12px;
  }

  .attention p {
    font-size: 11px;
    line-height: 1.6;
    white-space: normal;
  }

  /* --- メインレイアウト縦積み --- */
  main.flex-r {
    flex-direction: column;
    padding: 10px 10px;
    gap: 10px;
  }

  .inner { width: 100%; }

  .disclaimer {
    font-size: 11px;
    max-width: 100%;
    white-space: normal;
  }
}

/* ============================================
   標準的なスマホ（〜414px）
============================================ */
@media (max-width: 414px) {
  .right a {
    font-size: 12px;
  }

  .attention p {
    font-size: 10.5px;
    line-height: 1.7;
  }

  .header-title a {
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .disclaimer {
    font-size: 10.5px;
    line-height: 1.8;
    padding: 0 8px;
    white-space: normal;
  }
}

/* ============================================
   小型スマホ（〜360px）
============================================ */
@media (max-width: 360px) {
  .attention {
    padding: 5px 8px;
  }

  .header-title a {
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .attention p {
    font-size: 10px;
    line-height: 1.7;
  }
}

/* ============================================
   印刷対応
============================================ */
@media print {
  header, .right, footer { display: none !important; }
  main { padding: 0 !important; }
}