/*
 * 銘柄別・時間帯ボラティリティ ヒートマップ — 本番フロントエンド スタイル
 * デザイン正本(ユーザー承認済みモック): scratchpad/hourly-mock/hourly-heatmap-mock-v0.1.html を踏襲。
 * WP埋め込み前提のため、全セレクタを .bsnyhour でスコープしグローバルCSSへ漏らさない
 * (パターンは site/public/volatility/gap/style.css と同一)。
 */

.bsnyhour, .bsnyhour * { box-sizing: border-box; }

.bsnyhour {
  --page-bg: #f2f5fa; --page-grad-a: #e8eef8; --page-grad-b: #f6f8fc;
  --glass-fill: rgba(255,255,255,0.65); --glass-border: rgba(255,255,255,0.22);
  --glass-shadow: 0 8px 28px rgba(5,25,62,0.12);
  --ink: #1b2a41; --ink-soft: #5a6b82; --accent: #0b3a75; --accent-soft: #dce7f5;
  --up: #0e8a5f; --down: #c43d4b;
  --bar: linear-gradient(90deg,#2e6fc4,#0b3a75);
  --chip-bg: rgba(11,58,117,0.08); --row-line: rgba(27,42,65,0.08);
  --warn-bg: #fdf3d7; --warn-ink: #7a5c00;
  --cat-fx: #2e6fc4; --cat-energy: #c4522e; --cat-metals: #a8862e; --cat-indices: #7a5ac4;
  --heat-r: 11, 58, 117;

  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, var(--page-grad-a), transparent 60%),
    radial-gradient(900px 420px at -10% 30%, var(--page-grad-b), transparent 55%),
    var(--page-bg);
  line-height: 1.6;
}

@media (prefers-color-scheme: dark) {
  .bsnyhour {
    --page-bg: #0d1526; --page-grad-a: #101b31; --page-grad-b: #0b1220;
    --glass-fill: rgba(20,33,56,0.65); --glass-border: rgba(255,255,255,0.10);
    --glass-shadow: 0 8px 28px rgba(0,0,0,0.45);
    --ink: #e4ebf5; --ink-soft: #93a3ba; --accent: #7db0e8; --accent-soft: #1b2f4d;
    --bar: linear-gradient(90deg,#3d7fd4,#7db0e8);
    --chip-bg: rgba(125,176,232,0.14); --row-line: rgba(228,235,245,0.09);
    --warn-bg: #3a3216; --warn-ink: #e8cf7a;
    --heat-r: 125, 176, 232;
  }
}
:root[data-theme="light"] .bsnyhour, .bsnyhour[data-theme="light"] {
  --page-bg: #f2f5fa; --page-grad-a: #e8eef8; --page-grad-b: #f6f8fc;
  --glass-fill: rgba(255,255,255,0.65); --glass-border: rgba(255,255,255,0.22);
  --glass-shadow: 0 8px 28px rgba(5,25,62,0.12);
  --ink: #1b2a41; --ink-soft: #5a6b82; --accent: #0b3a75; --accent-soft: #dce7f5;
  --bar: linear-gradient(90deg,#2e6fc4,#0b3a75);
  --chip-bg: rgba(11,58,117,0.08); --row-line: rgba(27,42,65,0.08);
  --warn-bg: #fdf3d7; --warn-ink: #7a5c00;
  --heat-r: 11, 58, 117;
}
:root[data-theme="dark"] .bsnyhour, .bsnyhour[data-theme="dark"] {
  --page-bg: #0d1526; --page-grad-a: #101b31; --page-grad-b: #0b1220;
  --glass-fill: rgba(20,33,56,0.65); --glass-border: rgba(255,255,255,0.10);
  --glass-shadow: 0 8px 28px rgba(0,0,0,0.45);
  --ink: #e4ebf5; --ink-soft: #93a3ba; --accent: #7db0e8; --accent-soft: #1b2f4d;
  --bar: linear-gradient(90deg,#3d7fd4,#7db0e8);
  --chip-bg: rgba(125,176,232,0.14); --row-line: rgba(228,235,245,0.09);
  --warn-bg: #3a3216; --warn-ink: #e8cf7a;
  --heat-r: 125, 176, 232;
}

.bsnyhour .wrap { max-width: 980px; margin: 0 auto; padding: 20px 14px 48px; }

.bsnyhour .meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.bsnyhour .badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--chip-bg); color: var(--accent);
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
}
.bsnyhour .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.bsnyhour .src-note { font-size: 11.5px; color: var(--ink-soft); }

.bsnyhour .glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
}

.bsnyhour .tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px; margin-bottom: 4px; }
.bsnyhour .tabs button {
  flex: 0 0 auto; border: 0; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  background: transparent; padding: 8px 14px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 7px;
}
.bsnyhour .tabs button .cdot { width: 8px; height: 8px; border-radius: 50%; }
.bsnyhour .tabs button.on { background: var(--accent); color: #fff; }
.bsnyhour .tabs button.on .cdot { background: #fff !important; }
.bsnyhour .tabs button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.bsnyhour .heat-caption { font-size: 11.5px; color: var(--ink-soft); padding: 0 14px 8px; }

.bsnyhour .board { padding: 4px 10px 14px; overflow-x: auto; }
.bsnyhour table.heat { width: 100%; border-collapse: collapse; min-width: 880px; }
.bsnyhour table.heat th { font-size: 10px; font-weight: 600; color: var(--ink-soft); text-align: center; padding: 3px 1px; }
.bsnyhour table.heat th.symcol, .bsnyhour table.heat td.symcol {
  text-align: left; position: sticky; left: 0; padding-left: 8px;
  background: var(--glass-fill); backdrop-filter: blur(10px);
}
.bsnyhour table.heat td.symcol .nm { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.bsnyhour table.heat td.symcol .sub { font-size: 10px; color: var(--ink-soft); white-space: nowrap; }
.bsnyhour table.heat tr.symrow { cursor: pointer; }
.bsnyhour table.heat tr.symrow:hover td.symcol { color: var(--accent); }
.bsnyhour td.cell {
  width: 30px; height: 26px; text-align: center; font-size: 9.5px;
  font-variant-numeric: tabular-nums; color: var(--ink); position: relative;
  border: 1px solid var(--row-line);
}
.bsnyhour td.cell.low-n { border-style: dashed; opacity: 0.55; }
.bsnyhour td.cell.nodata { color: var(--ink-soft); border-style: dashed; opacity: 0.4; background: transparent !important; }
.bsnyhour td.cell[data-sel="1"] { outline: 2px solid var(--accent); outline-offset: -2px; }

.bsnyhour .legend-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 0 14px 12px; font-size: 11px; color: var(--ink-soft); }
.bsnyhour .legend-swatch { display: inline-flex; align-items: center; gap: 5px; }
.bsnyhour .legend-swatch i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.bsnyhour .legend-swatch i.low { border: 1px dashed var(--ink-soft); background: transparent; }
.bsnyhour .legend-swatch i.nodata { border: 1px dashed var(--ink-soft); background: transparent; opacity: 0.5; }

.bsnyhour section.block { margin-top: 22px; }
.bsnyhour section.block h2 { font-size: 16px; margin: 0 0 10px; padding: 0 4px; }

.bsnyhour .detail { padding: 16px; }
.bsnyhour .detail-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bsnyhour .detail-head .dnm { font-size: 15px; font-weight: 700; }
.bsnyhour .detail-head .dsub { font-size: 11.5px; color: var(--ink-soft); }
.bsnyhour .bars24 { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding: 0 2px; }
.bsnyhour .bars24 .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bsnyhour .bars24 .b { width: 100%; border-radius: 3px 3px 0 0; background: var(--bar); min-height: 2px; }
.bsnyhour .bars24 .col.low-n .b { opacity: 0.45; background: var(--ink-soft); }
.bsnyhour .bars24 .col.peak .b { background: var(--down); }
.bsnyhour .bars24 .col.nodata .b { opacity: 0.25; background: var(--ink-soft); }
.bsnyhour .bars24 .hlabel { font-size: 8.5px; color: var(--ink-soft); margin-top: 3px; }
.bsnyhour .detail-foot { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--ink-soft); }
.bsnyhour .detail-foot b { color: var(--ink); }
.bsnyhour .heat-hint { font-size: 10.5px; color: var(--ink-soft); }

@media (max-width: 560px) {
  .bsnyhour section.block h2 { font-size: 15px; }
  /* モバイルはヒートマップを「色で読む」形にする＝極小の数字(8px)を隠して見やすい
     色ブロックにし、正確な値は行タップで開く銘柄別バーグラフで確認できるようにする。
     !important で SWELL/本番#body_wrap のテーブル装飾より確実に勝たせる。 */
  .bsnyhour td.cell { width: 22px !important; height: 30px !important; font-size: 0 !important; }
  .bsnyhour table.heat th { font-size: 9px !important; padding: 3px 0 !important; }
  .bsnyhour table.heat td.symcol .nm { font-size: 11.5px; }
  .bsnyhour table.heat td.symcol .sub { font-size: 9px; }
  .bsnyhour .heat-caption { font-size: 11px; }
  /* 横スクロールできることを明示 */
  .bsnyhour .heat-hint::after { content: " —— 横スクロールで24時間分を表示"; }
}

/* ===== WP(SWELL)埋め込み時のテーブル装飾打ち消し =====
   SWELLは本文内tableのthead/td/trに紺帯・ボーダー・縞模様を適用する
   （#body_wrap配下の高特異度セレクタ）。モックのガラス調に戻すため、
   本番ページでのみ効く #body_wrap 前置＋!important で上書きする。
   (パターンは site/public/volatility/gap/style.css と同一) */
#body_wrap .bsnyhour table,
#body_wrap .bsnyhour table tr,
#body_wrap .bsnyhour table tbody tr:nth-child(2n),
#body_wrap .bsnyhour table tbody tr:nth-child(2n+1) {
  background: transparent !important;
  border: none !important;
}
#body_wrap .bsnyhour table.heat th {
  background: transparent !important;
  color: var(--ink-soft) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  text-align: center !important;
  padding: 3px 1px !important;
  border: none !important;
}
#body_wrap .bsnyhour table.heat th.symcol { text-align: left !important; padding-left: 8px !important; }
#body_wrap .bsnyhour td.cell {
  border: 1px solid var(--row-line) !important;
  padding: 0 !important;
}
#body_wrap .bsnyhour td.cell.low-n,
#body_wrap .bsnyhour td.cell.nodata { border-style: dashed !important; }
#body_wrap .bsnyhour td.symcol {
  background: var(--glass-fill) !important;
  border: none !important;
  padding-left: 8px !important;
}
