/* =====================================================================
   SCALING — main stylesheet for daily/weekly/monthly/total and the landing page.
   Load it AFTER menu.css and faq.css (it overrides a few menu sizes).

   One rule drives all sizing: the root font size.
     1280px wide (your laptop) -> 16px  (same as today)
     1920px wide               -> 20px
     2560px wide and above     -> 24px  (capped)
   Everything below is in rem, so header, logo, title, buttons, chart,
   FAQ and footer all grow by the same factor. The chart scripts read the
   same root size (scaling.js), so canvas text follows along too.
   ===================================================================== */

html {
  font-size: clamp(1rem, 0.5rem + 0.625vw, 1.5rem);
}

:root {
  --page-max: 120rem;   /* widest the content gets (2880px at the cap) */
  --header-h: 6.5rem;   /* logo 4rem + 2 x 1.25rem padding */
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #1c1c1c;
}

::-webkit-scrollbar { width: 10px; background-color: black; }
::-webkit-scrollbar-thumb { background-color: #F44336; }
::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgb(0, 0, 0); }

::selection { background-color: #FA6862; color: #fff; }

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #F44336;
  padding: 1.25rem;                 /* was 20px */
  box-shadow: rgba(0, 0, 0, 0.50) 0 0.5rem 1rem;
}

.logo {
  height: 4rem;                     /* was 10vh: grew with screen HEIGHT, unlike everything else */
  width: auto;
}

/* menu.css overrides: icon sized in rem instead of vmin */
.icon--menu-toggle { --size: 2.6rem; }
.main-navigation-toggle + label { right: 1.5rem; }

/* ---------- Text ---------- */
h2 { color: white; }
p  { color: white; }

h4 {
  text-align: center;
  color: white;
  font-size: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.8rem;
}

#subtitle {
  grid-column: 2;
  margin: 1rem 0 0;
  text-align: center;
  color: white;
  font-size: 0.9rem;
  line-height: 1.1;
}
#subtitle .total {
  margin: 0;
  display: block;
  font-size: 1.2rem;
  color: #fff;
  line-height: 0.1;
}
.subtitle {
  text-align: center;
  color: white;
  font-size: 0.75rem;
  margin: 0;
}

.alert {
  background-color: #ED7D31;
  box-shadow: rgba(0, 0, 0, 0.50) 0 0.5rem 1rem;
  padding-block: 0.15rem;           /* was 0.2vh */
}
header + .alert { margin-top: 0; }

.question { font-weight: bold; }
.link { color: white; text-decoration: underline; }
.link:hover { color: #FA6862; }

/* ---------- Chart card ---------- */
.chartCardContainer {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;                      /* was 3vh */
  padding: 1rem 0.75rem 4rem;
}

.myChartCard {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
}

/* Height follows the WIDTH (like the text does), but never taller than
   the screen below the header. Laptop: ~1256 x 490, 1920: ~1880 x 780,
   2560: ~2520 x 1070, so the chart keeps the same shape everywhere. */
.chart-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2.3 / 1;
  min-height: 26rem;
  max-height: calc(100vh - var(--header-h));
}

/* Horizontal mode: height from the number of bars (--bars is set from JS),
   so each bar keeps the same thickness relative to its label. */
.myChartCard.is-horizontal .chart-wrap {
  aspect-ratio: auto;
  height: calc(var(--bars, 45) * 1.5rem + 5rem);
  max-height: none;
}

#myChart { display: block; }

.chart-meta {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;  /* equal side columns = truly centered middle */
  align-items: center;
  padding: 0 0.75rem;
  margin-bottom: 0.75rem;
}

.chart-toolbar {
  grid-column: 1;
  justify-self: start;
  display: flex;
  gap: 0.5rem;
  padding: 0;
}

.chart-btn {
  appearance: none;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 0.375rem;
  padding: 0.45rem 0.9rem;
  min-height: 2.2rem;
  font: 600 0.85rem/1 Roobert, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: background .2s, border-color .2s;
}
.chart-btn[aria-pressed="true"] {
  border-color: #F44336;
  background: rgba(244, 67, 54, .15);
}
.chart-btn:focus-visible { outline: 2px solid #F44336; outline-offset: 2px; }

@media (hover: hover) {
  .chart-btn:hover { background: rgba(255, 255, 255, .08); }
}

.legend-tooltip {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.35rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.85rem;               /* replaces the 1500/2500/3000px jumps */
  max-width: 20rem;
  display: none;
  pointer-events: none;
  z-index: 3;
}

/* ---------- FAQ section + footer ---------- */
.case {
  display: flex;
  background-color: #333;
}

footer {
  background-color: #1c1c1c;
  color: white;
  padding: 2rem;                    /* was 30px */
}

.footerHeader {
  color: white;
  display: block;
  font-size: 1.17em;
  margin-block: 1em;
  font-weight: bold;
}

.headerLink:hover { background-color: #f35c51; }
.dropdown { z-index: 10; }

/* ---------- Partner banners ---------- */
.skinledgerContainer { text-align: center; }
.skinledgerLink { display: inline-block; }

.skinledgerHorizontal {
  display: inline-block;
  max-width: min(60vw, calc(var(--page-max) * 0.6));
}
.tradeuplabHorizontal {
  display: inline-block;
  max-width: min(70vw, calc(var(--page-max) * 0.7));
}
.cswhaleContainer {
  width: min(60%, calc(var(--page-max) * 0.6));
  margin: 0 auto;
}
.cswhaleContainer iframe {
  width: 100%;
  aspect-ratio: 2.7 / 1;
  border: none;
}

.scroll-images::-webkit-scrollbar { width: 5px; height: 8px; background-color: #1c1c1c; }
.scroll-images::-webkit-scrollbar-thumb { background-color: #F44336; }

/* ---------- Small screens (root size stays 16px here) ---------- */
@media (max-width: 800px) {
  .chart-meta {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }
  #subtitle { grid-column: 1; order: 1; }
  .chart-toolbar { grid-column: 1; justify-self: center; order: 2; }
}

@media (max-width: 768px) {
  .skinledgerHorizontal { max-width: 75vw; }
  .tradeuplabHorizontal { max-width: 90vw; }
  .cswhaleContainer { width: 75%; }
}

@media (max-width: 700px) {
  .chart-wrap { aspect-ratio: 3 / 4; min-height: 0; max-height: none; }
}

@media (max-width: 630px) {
  .chart-btn { font-size: 0.7rem; padding: 0.3rem 0.6rem; min-height: 1.9rem; }
}

@media (max-width: 550px) {
  .logo { width: 60%; height: auto; }
  header { font-size: 10px; padding: 0.6rem; }
  .skinledgerHorizontal { max-width: 95vw; }
  .tradeuplabHorizontal { max-width: 98vw; }
  .cswhaleContainer { width: 95%; }
}

@media (max-width: 400px) {
  header { padding: 0.3rem; }
}
