/* AIX v3+: テーブル長文セル折返し
   v4 fix: table-layout:fixed と overflow-wrap:anywhere の組合せで cell 内 <pre> や
           長文行が row 高を狂わせ、行同士が視覚的に重なる問題があったため、
           layout を auto に戻し、word-break を緩和、line-height/overflow を明示。 */

/* テーブル全体: width: 100% は維持、layout は auto に戻す */
.md-typeset table:not([class]) {
  width: 100%;
  font-size: 0.78rem;
}

/* セル: 折返し有効・行高明示・overflow 可視 */
.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  word-break: break-word;
  white-space: normal;
  padding: 0.4em 0.5em;
  vertical-align: top;
  line-height: 1.5;
  overflow: visible;
}

/* セル内 <pre> / <code> ブロック: 余白を 0 にして cell 高さを乱さない、
   テキストは pre-wrap で折返す */
.md-typeset table:not([class]) pre,
.md-typeset table:not([class]) code {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ヘッダ: 中央寄せ + 太字 */
.md-typeset table:not([class]) th {
  text-align: center;
  font-weight: 600;
  background-color: var(--md-default-fg-color--lightest);
}

/* 偶数行に薄い色を付けて読みやすく */
.md-typeset table:not([class]) tr:nth-child(even) {
  background-color: rgba(0,0,0,0.02);
}

/* インライン code は半角詰め */
.md-typeset code {
  font-size: 0.85em;
}

/* AIX v3 用 procedure card レイアウト */
.proc-card {
  border-left: 4px solid #305496;
  padding: 0.5em 1em;
  margin: 1em 0;
  background-color: rgba(48,84,150,0.04);
}
.proc-card h3 {
  margin-top: 0;
}

/* 関連リンクボックス */
.related-links {
  font-size: 0.8em;
  color: #555;
  margin-top: 0.3em;
  padding-left: 0.5em;
  border-left: 2px solid #ccc;
}

/* ===== v12 / zos-v4: モバイル時テーブル overflow 対策 ===== */
@media (max-width: 768px) {
  .md-typeset__table {
    max-width: calc(100vw - 1rem) !important;
    overflow-x: auto !important;
  }
  .md-typeset__table table {
    min-width: auto !important;
    width: max-content;
    max-width: none;
  }
  .md-typeset table:not([class]) {
    font-size: 0.7rem;
  }
  /* netcool v1.1: scrollwrap div (manually wrapped wide tables) also needs mobile overflow */
  .md-typeset__scrollwrap {
    max-width: calc(100vw - 1rem) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .md-typeset__scrollwrap table {
    width: max-content;
    min-width: auto !important;
    max-width: none;
    font-size: 0.7rem;
  }
  /* db2 v1.1: re-enforce 32x32 button on mobile (defensive against JS inline padding) */
  /* netcool v1.1: hide text via font-size:0, show emoji via ::before keyed on data-mode.
     - default (mobile mode, no attribute or data-mode='mobile'): 💻 (click to switch to PC)
     - data-mode='desktop' (PC mode active): 📱 (click to switch back to mobile)         */
  #pc-view-btn {
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 0 !important;
    overflow: hidden !important;
  }
  #pc-view-btn::before {
    content: "💻";
    font-size: 18px;
    line-height: 32px;
    display: inline-block;
  }
  #pc-view-btn[data-mode="desktop"]::before {
    content: "📱";
  }
}

/* ===== v12: 広いマトリクス表の横スクロールラッパ ===== */
.md-typeset__scrollwrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== v12: PC ビュー切替ボタンの遮蔽問題対策 =====
   v13: overflow:hidden + white-space:nowrap でテキストの 32px 円外リークを抑止
   （内部 textContent "💻 PC 表示" が scrollHeight=96 で下方 64px 漏れていた）
   netcool v1.2 hotfix: font-size:0 をグローバルに昇格。v1.1 では @media(<=768px) 内の
   font-size:0 がここのグローバル font-size:14px に cascade 順負け（後者が later）→
   モバイルで text が再露出する事象が再発。グローバルで 0 にして desktop @media (>=769px)
   の font-size:inherit で復活させる方式に変更（1 line hotfix）。*/
#pc-view-btn {
  bottom: calc(env(safe-area-inset-bottom, 0) + 80px) !important;
  width: 32px !important;
  height: 32px !important;
  font-size: 0 !important;
  padding: 0 !important;
  line-height: 32px !important;
  text-align: center;
  z-index: 100;
  overflow: hidden !important;
  white-space: nowrap !important;
}
@media (min-width: 769px) {
  #pc-view-btn {
    bottom: 24px !important;
    width: auto !important;
    height: auto !important;
    font-size: inherit !important;
    padding: 0.5em 1em !important;
    line-height: 1.4 !important;
    overflow: visible !important;
    white-space: normal !important;
  }
}
