/* ============================================================
   bitcoin-hashrate.css — page-owned layout and chart controls.
   All colors use --home-* tokens from theme-terminal.css so the
   page matches mempool/fees/explorer. Adds the missing base
   layout for .metric-card / .content-card (padding, grid),
   which previously had none. Amber literals updated to
   rgba(245,184,61,…) = --home-amber #f5b83d.
   ============================================================ */

.hashrate-page { max-width: 1120px; }
.hashrate-hero { padding-top: 2.2rem; }
.hashrate-hero h1 { max-width: 980px; }
.hashrate-hero p { max-width: 980px; }

/* Metric cards — same language as .terminal-stat on home/mempool */
.hashrate-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 1.4rem;
}
.metric-card {
  padding: 16px 18px;
  transition: border-color .18s ease;
}
.metric-card:hover { border-color: var(--home-line2) !important; }
.metric-card span {
  display: block;
  font-family: var(--home-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--home-muted);
}
.metric-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--home-mono);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--home-ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric-card.primary strong { color: var(--home-amber); }
.metric-card small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--home-muted);
}

/* Content panels — same padding rhythm as .terminal-intelligence-panel */
.content-card {
  padding: 18px;
  margin-bottom: 14px;
}
.content-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.content-card > p {
  color: var(--home-ink);
  max-width: 860px;
}
.content-card .panel-head { margin-bottom: 6px; }
.content-card .panel-head h2 { margin: 2px 0 0; }

.metric-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: 1rem 0;
}
.metric-switcher button {
  border: 1px solid var(--home-line2);
  background: var(--home-panel);
  color: var(--home-muted);
  border-radius: 999px;
  padding: .5rem .85rem;
  cursor: pointer;
  font-family: var(--home-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.metric-switcher button:hover {
  border-color: rgba(245, 184, 61, .55);
  color: var(--home-ink);
}
.metric-switcher button.active {
  background: rgba(245, 184, 61, .12);
  border-color: var(--home-amber);
  color: var(--home-amber);
}
.hashrate-chart {
  height: 460px;
  width: 100%;
  margin-top: 1rem;
  border: 1px solid var(--home-line);
  border-radius: 6px;
  background: var(--home-panel);
  overflow: hidden;
  position: relative;
}
.chart-tooltip {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  min-width: min(230px, calc(100% - 16px));
  max-width: min(320px, calc(100% - 16px));
  padding: .72rem .82rem;
  border-radius: 6px;
  border: 1px solid rgba(245, 184, 61, .45);
  background: var(--home-panel2);
  color: var(--home-ink);
  font-family: var(--home-mono);
  font-size: .8rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.chart-tooltip strong {
  color: var(--home-amber);
  font-weight: 600;
  display: block;
  margin-bottom: .3rem;
}
.chart-tooltip div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--home-line);
  padding-top: .25rem;
  margin-top: .25rem;
}
.chart-tooltip[hidden] {
  display: none;
}
.hashrate-table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--home-line);
  border-radius: 6px;
  background: var(--home-panel);
}
.hashrate-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--home-mono);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}
.hashrate-table th,
.hashrate-table td {
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--home-line);
  text-align: right;
  white-space: nowrap;
}
.hashrate-table th:first-child,
.hashrate-table td:first-child {
  text-align: left;
}
.hashrate-table thead th {
  position: sticky;
  top: 0;
  background: var(--home-panel2);
  color: var(--home-muted);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  z-index: 1;
}
.hashrate-status {
  margin-top: .75rem;
  color: var(--home-muted);
  font-family: var(--home-mono);
  font-size: .82rem;
}
.hashrate-history-warning {
  margin: .75rem 0 0;
  padding: .7rem .85rem;
  border: 1px solid rgba(245, 184, 61, .45);
  border-radius: 6px;
  background: rgba(245, 184, 61, .08);
  color: #f5cf79;
  font-family: var(--home-mono);
  font-size: .82rem;
}
.price-overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  margin: 0;
  padding: .65rem .95rem;
  border: 1px solid var(--home-line);
  border-radius: 6px;
  background: var(--home-panel);
  cursor: pointer;
  user-select: none;
}
.price-overlay-toggle:hover {
  border-color: rgba(245, 184, 61, .55);
  background: var(--home-panel2);
}
.price-overlay-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.price-overlay-check {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--home-line2);
  background: var(--home-panel2);
  position: relative;
  flex: 0 0 auto;
  transition: border-color .18s ease, background .18s ease;
}
.price-overlay-check::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--home-muted);
  position: absolute;
  left: 3px;
  top: 2px;
  transition: transform .18s ease, background .18s ease;
}
.price-overlay-toggle input:checked + .price-overlay-check {
  border-color: var(--home-amber);
  background: rgba(245, 184, 61, .18);
}
.price-overlay-toggle input:checked + .price-overlay-check::after {
  transform: translateX(18px);
  background: var(--home-amber);
}
.price-overlay-toggle input:focus-visible + .price-overlay-check {
  outline: 2px solid var(--home-amber);
  outline-offset: 2px;
}
.price-overlay-copy {
  display: grid;
  gap: .1rem;
  line-height: 1.1;
}
.price-overlay-copy strong {
  font-family: var(--home-mono);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--home-ink);
}
.price-overlay-copy small {
  color: var(--home-muted);
  font-size: .76rem;
}
.overlay-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: .35rem 0 1rem;
}
@media (max-width: 980px) {
  .hashrate-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .hashrate-chart { height: 340px; }
  .hashrate-table { font-size: .78rem; }
}
@media (max-width: 520px) {
  .hashrate-metric-grid { grid-template-columns: 1fr; }
}

/* Retargets remain a compact scrollable table on phones as well as desktop.
   Do not inherit the daily-history table's mobile card transformation. */
.hashrate-retarget-panel { min-width: 0; }
.retarget-table-wrap {
  max-height: 420px;
  overflow: auto;
  scrollbar-gutter: stable;
  border: 1px solid var(--home-line);
  border-radius: 6px;
  background: var(--home-panel);
}
.retarget-table-wrap:focus-visible,
.hashrate-range-controls button:focus-visible,
.metric-switcher button:focus-visible {
  outline: 2px solid var(--home-amber);
  outline-offset: 3px;
}
.retarget-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--home-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.retarget-table th, .retarget-table td {
  padding: 12px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--home-line);
}
.retarget-table th:first-child, .retarget-table td:first-child { text-align: left; }
.retarget-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--home-panel2);
  color: var(--home-muted);
  font-size: 11px;
  font-weight: 500;
}
.retarget-table .retarget-up { color: #4ade80; }
.retarget-table .retarget-down { color: #fb7185; }
.retarget-table .retarget-flat { color: var(--home-muted); }
.hashrate-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.hashrate-range-controls { display: flex; gap: 8px; margin-top: 12px; }
.hashrate-range-controls button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--home-line2);
  border-radius: 6px;
  background: var(--home-panel);
  color: var(--home-muted);
  font: 12px var(--home-mono);
  cursor: pointer;
}
.hashrate-range-controls button.active {
  color: var(--home-amber);
  border-color: var(--home-amber);
  background: rgba(245, 184, 61, .1);
}
.hashrate-chart { min-width: 0; box-sizing: border-box; }
@media (max-width: 760px) {
  .hashrate-page .hashrate-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hashrate-page .metric-card { min-width: 0; padding: 12px; }
  .hashrate-page .metric-card span { font-size: 10px; letter-spacing: .04em; }
  .hashrate-page .metric-card strong { font-size: clamp(17px, 4.5vw, 24px); }
  .hashrate-history-panel { min-width: 0; }
  .hashrate-page .metric-switcher { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .hashrate-page .metric-switcher button { min-width: 0; min-height: 44px; padding: 8px 4px; font-size: 10px; letter-spacing: 0; }
  .hashrate-page .overlay-toggles { display: grid; grid-template-columns: 1fr; gap: 6px; }
  .hashrate-page .price-overlay-toggle { padding: 8px 10px; min-height: 44px; box-sizing: border-box; }
  .hashrate-page .price-overlay-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .hashrate-page .price-overlay-copy strong { font-size: 11px; letter-spacing: .03em; }
  .hashrate-page .price-overlay-copy small { font-size: 11px; }
  .hashrate-range-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hashrate-range-controls button { min-width: 0; padding: 8px 4px; }
  .hashrate-page .hashrate-status { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .retarget-table th, .retarget-table td { padding: 12px 6px; font-size: 11px; }
  .retarget-table thead th { font-size: 10px; }
  .retarget-table-wrap { max-height: 360px; }
}

/* styles.css turns every table into cards on phones, including the chart
   library's internal layout table. Keep that layout a table at every width. */
#hashrateHistoryChart table { display: table; width: 100%; min-width: 0; border-collapse: collapse; }
#hashrateHistoryChart tbody { display: table-row-group; }
#hashrateHistoryChart tr { display: table-row; }
#hashrateHistoryChart td { display: table-cell; }
#hashrateHistoryChart tbody,
#hashrateHistoryChart tr,
#hashrateHistoryChart td {
  width: auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  border-radius: 0;
  /* Defeat theme-terminal.css's global tbody borders and hover paint. */
  border: 0 !important;
  background: transparent !important;
}
#hashrateHistoryChart td::before { content: none; }
body.terminal-site .retarget-table thead th {
  /* Defeat theme-terminal.css's transparent !important table headers. */
  background: var(--home-panel2) !important;
  letter-spacing: .02em !important;
}
@media (max-width: 760px) {
  /* Defeat theme-terminal.css's fixed 24px !important metric values. */
  body.terminal-home .hashrate-page .metric-card strong { font-size: clamp(14px, 4vw, 20px) !important; }

}
@media (max-width: 760px) {
  /* Defeat theme-terminal.css's !important global button typography. */
  body.terminal-site .hashrate-page .metric-switcher button { font-size: 10px !important; letter-spacing: 0 !important; }
}

/* Preserve real columns through the legacy 820px card-table breakpoint. */
.retarget-table { display: table; }
.retarget-table thead { display: table-header-group; }
.retarget-table tbody { display: table-row-group; }
.retarget-table tr { display: table-row; width: auto; padding: 0; border: 0; border-radius: 0; background: transparent; }
.retarget-table th, .retarget-table td { display: table-cell; width: auto; min-width: 0; overflow-wrap: normal; }
.retarget-table td::before { content: none; }
/* Defeat theme-terminal.css's generic !important button paint so the
   selected metric and range remain visible. Exceptions stay page-scoped. */
body.terminal-site .hashrate-page .metric-switcher button.active,
body.terminal-site .hashrate-page .hashrate-range-controls button.active {
  color: var(--home-amber) !important;
  border-color: var(--home-amber) !important;
  background: rgba(245, 184, 61, .12) !important;
}
