/* ===================================================
   base.css - 全ページ共通スタイル
   bodyリセット / 背景 / スクロールバー非表示 / navbar / back-btn / page-top-button
   fade-in-up / operation-block / 見出し下線 / title-explanation / double-space
   color系 / emphasis-section / image-box / content-image / search-input
   ページネーション / page-toc / page-title / モバイル共通
   =================================================== */

/* --- 1. body リセット・背景 --- */
html {
  min-height: 100%;
  background: #fff;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  padding-top: 82px;
  background-color: #fff;
  color: #222;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
}

/* モバイル等で背景を固定表示するための疑似要素（body::before） */
body {
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url('../img/background.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: max(1920px, 100vw, calc(100vh * 16 / 9));
}

/* --- 2. スクロールバー非表示 --- */
html,
body {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none !important;
}

/* --- 3. ナビゲーションバー（統一値） --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 5%;
  background-color: rgba(248, 248, 248, 0.342);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-sizing: border-box;
}

.navbar .logo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}

.navbar .logo a {
  display: block;
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
}

.navbar .logo img {
  display: block;
  flex: 0 0 auto;
  width: 140px;
  max-width: 140px;
  height: auto;
  margin: 0;
}

.navbar .site-title {
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  display: block;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  color: #00a9ff;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.12;
  text-align: left;
  white-space: nowrap;
  letter-spacing: 0;
  background: none;
  -webkit-text-fill-color: currentColor;
}

.navbar .nav-links {
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  list-style: none;
  margin: 0 84px 0 auto;
  padding: 0;
}

.navbar .nav-links::before {
  content: "公式：";
  flex: 0 0 auto;
  color: #007ab8;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.navbar .nav-links li {
  margin: 0;
  padding: 0;
}

.navbar .nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 6px;
  background-color: #46d4ff;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.navbar .nav-links a:hover {
  background-color: #0094d8;
  transform: scale(1.05);
}

.navbar .nav-links a.sns-link {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  min-height: 0;
}

.navbar .nav-links a.sns-link:hover {
  background-color: transparent;
}

.navbar .nav-links a.sns-link img {
  display: block;
  height: 32px;
  width: auto;
}

.navbar .nav-links a.sns-link img[src*="yt.png"] {
  height: 48px;
}

/* --- 4. 戻るボタン（固定配置） --- */
.back-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 2000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-decoration: none;
}

.back-btn img {
  display: block;
  width: 50px;
  height: 50px;
  object-fit: contain;
  transition: filter 0.3s ease, transform 0.3s ease;
}

.back-btn:hover img {
  filter: brightness(1.2);
  transform: translateX(-3px);
}

/* --- 5. ページトップボタン --- */
.page-top-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #ffffff;
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(0, 148, 216, 0.28);
  text-decoration: none;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.page-top-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 148, 216, 0.34);
  filter: brightness(1.05);
}

/* --- 6. フェードイン（統一値: translateY(30px) 0.8s ease-out） --- */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-up.is-show {
  opacity: 1;
  transform: translateY(0);
}

/* --- 7. 記事ボックス（boxed text sections） --- */
.operation-block,
.content-card,
.comment-box {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  padding: 34px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(70, 212, 255, 0.28);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 148, 216, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

/* --- 8. 見出し下線 --- */
h1::after,
.main-title::after,
.section-title::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  margin: 12px auto 0;
  border-radius: 999px;
  background: #46d4ff;
}

/* --- 9. 章見出し（title-explanation） --- */
.title-explanation {
  display: block;
  font-size: 60px;
  font-weight: 900;
  background: linear-gradient(200deg, #8c00ff, #ffffff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- 10. 記事内テキスト余白（double-space） --- */
.double-space {
  margin-top: 72px;
  margin-bottom: 32px;
}

/* --- 11. テキスト色クラス --- */
.color-blue {
  color: #0094d8;
  font-size: 40px;
}

.color-green {
  color: #31a827;
  font-size: 40px;
}

.color-red {
  color: #c04f4f;
  font-size: 40px;
}

.color-yellow {
  color: #f5d000;
  font-size: 40px;
}

/* --- 12. 強調テキスト --- */
.emphasis-section {
  background-color: rgba(224, 70, 255, 0.301);
  padding: 7px;
  border-radius: 3px;
}

/* --- 13. 画像を囲むボックス --- */
:root {
  --content-image-width: 1000px;
}

.image-box {
  display: inline-block;
  width: auto;
  min-height: 0;
  margin: 24px auto 40px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 80, 120, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-sizing: border-box;
}

/* --- 14. 本文画像 --- */
.content-image {
  display: block;
  width: min(var(--content-image-width), 90vw);
  max-width: 100%;
  height: auto;
  margin: 16px auto 32px;
}

.image-box .content-image {
  margin: 0;
}

/* --- 15. 検索入力（class="search-input"） --- */
.search-container {
  display: flex;
  justify-content: center;
  margin: 30px auto;
  width: 100%;
  max-width: 520px;
  padding: 0 20px;
  box-sizing: border-box;
}

.search-input {
  width: 100%;
  padding: 12px 20px 12px 55px;
  font-size: 18px;
  border: 4px solid #46d4ff;
  border-radius: 30px;
  outline: none;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background-image: url('../img/search.png');
  background-repeat: no-repeat;
  background-position: 18px center;
  background-size: 25px auto;
}

.search-input:focus {
  box-shadow: 0 0 15px rgba(70, 212, 255, 0.4);
  border-color: #0094d8;
  transform: translateY(-2px);
}

/* --- 16. ページネーション --- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 40px 0 80px;
}

.page-btn {
  background: linear-gradient(135deg, #46d4ff, #0094d8);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(0, 148, 216, 0.3);
}

.page-btn:disabled {
  background: #e0e0e0;
  cursor: not-allowed;
}

#page-info {
  font-size: 16px;
  color: #666;
  margin-bottom: 20px;
  text-align: center;
}

#total-count,
#hit-count {
  font-weight: bold;
  font-size: 20px;
  color: #0094d8;
}

/* --- 17. 目次（page-toc） --- */
.page-toc {
  max-width: 560px;
  margin: 46px auto 70px;
  padding: 26px 30px 30px;
  background: rgba(255, 255, 255, 0.72);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.page-toc .toc-title {
  margin: 0 0 12px !important;
  color: #0094d8;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.page-toc .toc-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 3px;
  margin: 10px auto 12px;
  background: rgba(64, 64, 64, 0.85);
}

.toc-group {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 3px solid rgba(64, 64, 64, 0.85);
}

.toc-group:first-of-type {
  margin-top: 0;
  border-top: 0;
}

.toc-group-title {
  margin: 0 0 8px;
  color: #008ed0;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.toc-group .toc-links {
  margin-top: 0;
}

.toc-links {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc-links a {
  display: block;
  padding: 2px 12px 4px;
  color: #5f666b;
  background: transparent;
  border-radius: 0;
  text-decoration: none;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.22;
  text-align: center;
  box-shadow: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.toc-links a:hover {
  color: #008ed0;
  background: rgba(70, 212, 255, 0.16);
}

/* --- 18. 本文の大見出し（page-title） --- */
.page-title {
  margin: 24px auto 18px;
  color: #0094d8;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 56px;
  font-weight: 900;
}

/* --- 19. アイテム一覧準拠の文字統一 --- */
:where(main) :where(h1, .page-title, .main-title) {
  margin: 52px auto 16px;
  padding: 0 10px;
  color: #008fd3 !important;
  font-size: clamp(36px, 5vw, 58px) !important;
  font-weight: 900 !important;
  line-height: 1.22 !important;
  letter-spacing: 0 !important;
  text-align: center !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  -webkit-text-fill-color: currentColor !important;
}

:where(main) :where(h2, h3, .section-title, .subsection-title, .content-title, .operation-title, .dan-rank-title, .toc-title, .title-explanation, .color-blue, .color-green, .color-red) {
  color: #008fd3 !important;
  font-size: clamp(28px, 4vw, 42px) !important;
  font-weight: 900 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  -webkit-text-fill-color: currentColor !important;
}

:where(main) :where(p, li, dd, .item-intro, .page-description, .dan-intro-text, .unit-intro-text, .note-description, .item-page-info) {
  color: #444 !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.8 !important;
  letter-spacing: 0 !important;
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  -webkit-text-fill-color: currentColor !important;
}

:where(main) :where(.toc-links a, .toc-group-title) {
  color: #5f666b;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: none;
  -webkit-text-stroke: 0;
}

/* --- 20. モバイル共通 --- */
@media (max-width: 760px) {
  body {
    padding-top: 72px;
  }

  .navbar {
    flex-direction: row;
    min-height: 72px;
    gap: 10px;
    padding: 8px 74px 8px 12px;
    text-align: left;
  }

  .navbar .logo {
    flex-direction: row;
    gap: 10px;
    margin-bottom: 0;
  }

  .navbar .logo img {
    width: 96px;
    max-width: 96px;
  }

  .navbar .site-title {
    max-width: calc(100vw - 210px);
    font-size: 13px;
    line-height: 1.12;
    white-space: normal;
    overflow: visible;
  }

  .navbar .nav-links {
    display: none;
  }

  .back-btn {
    position: fixed;
    top: 82px;
    left: 12px;
    z-index: 790;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0;
  }

  .back-btn img {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
  }

  body {
    font-size: 14px !important;
  }

  main,
  section,
  article {
    font-size: 14px !important;
  }

  p,
  li,
  td,
  th,
  input,
  select,
  textarea,
  button,
  .toc-list a,
  .guide-button,
  .holodori-menu-link {
    font-size: 14px !important;
    line-height: 1.55 !important;
  }

  h1,
  .display-title {
    font-size: 28px !important;
    line-height: 1.22 !important;
  }

  h2,
  .section-title {
    font-size: 22px !important;
    line-height: 1.25 !important;
  }

  h3,
  .subsection-title {
    font-size: 18px !important;
    line-height: 1.3 !important;
  }

  .page-title {
    font-size: 40px;
  }
}

@media (max-width: 700px) {
  .page-toc {
    margin: 34px auto 54px;
    padding: 22px 18px 24px;
  }

  .page-toc .toc-title {
    font-size: 30px;
  }

  .toc-links a {
    font-size: 21px;
  }

  .toc-group-title {
    font-size: 20px;
  }
}

@media (max-width: 380px) {
  .navbar {
    padding-right: 66px;
  }

  .navbar .logo img {
    width: 82px;
    max-width: 82px;
  }

  .navbar .site-title {
    max-width: calc(100vw - 180px);
    font-size: 12px;
    line-height: 1.1;
  }

  .back-btn {
    top: 78px;
    width: 38px;
    height: 38px;
  }

  .back-btn img {
    width: 38px;
    height: 38px;
  }

  body,
  main,
  section,
  article,
  p,
  li,
  td,
  th,
  input,
  select,
  textarea,
  button,
  .toc-list a,
  .guide-button,
  .holodori-menu-link {
    font-size: 13px !important;
  }

  h1,
  .display-title {
    font-size: 24px !important;
  }

  h2,
  .section-title {
    font-size: 20px !important;
  }
}
