/* ============================================================
   BULLS & BEARS · Dashboard + shared app shell (editorial)
   Class names match the JS-generated markup — logic untouched.
   ============================================================ */

.app { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 2; }

/* ---- Masthead: floating pill ---- */
.masthead { position: sticky; top: 0; z-index: 80; padding: 14px var(--gutter) 0; }
.masthead-inner {
  max-width: var(--maxw); margin: 0 auto;
  background: rgba(252,252,249,0.82);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--hair); border-radius: var(--pill);
  padding: 9px 12px 9px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand .seal {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--accent); color: var(--accent);
  display: grid; place-items: center; font-family: var(--f-serif); font-weight: 400; font-size: 1.05rem;
  transition: background 0.25s, color 0.25s;
}
.brand:hover .seal { background: var(--accent); color: var(--accent-ink); }
.brand .seal svg { width: 19px; height: 19px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.02; }
.wordmark .name { font-family: var(--f-serif); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.022em; }
.wordmark .name .amp { color: var(--accent); padding: 0 0.04em; }
.wordmark .sub { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-mute); font-weight: 600; margin-top: 1px; }

.masthead-right { display: flex; align-items: center; gap: 12px; }
.last-updated { font-size: 0.72rem; color: var(--ink-mute); white-space: nowrap; }

/* Segmented pill (year, filters) */
.year-selector, .chart-filters {
  display: inline-flex; padding: 4px; gap: 2px;
  background: rgba(24,27,32,0.05); border-radius: var(--pill);
}
.year-btn, .filter-btn {
  appearance: none; border: none; background: none; cursor: pointer;
  font-weight: 500; color: var(--ink-soft); padding: 6px 15px; border-radius: var(--pill);
  font-size: 0.82rem; transition: all 0.2s var(--ease); white-space: nowrap;
}
.year-btn:hover, .filter-btn:hover { color: var(--ink); }
.year-btn.active, .filter-btn.active { background: var(--ink); color: var(--ivory); }

.back-pill {
  display: inline-flex; align-items: center; gap: 7px; color: var(--ink); font-size: 0.8rem; font-weight: 500;
  padding: 8px 15px 8px 13px; border-radius: var(--pill); border: 1px solid var(--hair); background: rgba(252,252,249,0.6);
  transition: border-color 0.2s, background 0.2s;
}
.back-pill:hover { border-color: var(--ink); background: var(--ivory); }
.back-pill .ar { font-size: 0.95rem; }

/* ---- Main ---- */
.main {
  width: 100%; max-width: var(--maxw); margin: 0 auto; flex: 1;
  padding: clamp(1.5rem, 3.5vw, 2.6rem) var(--gutter) 4rem;
  display: flex; flex-direction: column; gap: clamp(2rem, 4vw, 3.4rem);
}

.section { display: flex; flex-direction: column; gap: 1.2rem; }

/* Compact density */
[data-density="compact"] .main { gap: clamp(1.5rem, 3vw, 2.4rem); }
[data-density="compact"] .leaderboard tbody td { padding: 0.58rem 1.1rem; }
[data-density="compact"] .leader-card { padding: 1.1rem 1.2rem; gap: 0.85rem; }
[data-density="compact"] .highlight-card { padding: 1.1rem 1.2rem; }
[data-density="compact"] .scrubber { padding: 0.85rem 1.2rem; }
[data-density="compact"] .name-link { font-size: 1.05rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-title {
  font-family: var(--f-serif); font-weight: 500; font-variation-settings: "opsz" 72;
  font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.05; letter-spacing: -0.025em; color: var(--ink); white-space: nowrap;
}
.section-title .accent { color: var(--accent); }
.section-note { font-size: 0.82rem; color: var(--ink-mute); }

/* ---- Week scrubber ---- */
.scrubber {
  background: var(--ivory); border: 1px solid var(--hair); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 1.1rem 1.5rem;
  display: flex; align-items: center; gap: 1.6rem;
}
.scrubber-label { display: flex; flex-direction: column; gap: 0.15rem; white-space: nowrap; }
.scrubber-label .ov { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); font-weight: 600; }
.week-date-display { font-family: var(--f-serif); font-size: 1.3rem; font-weight: 400; color: var(--ink); line-height: 1; letter-spacing: -0.01em; }
.week-number { font-size: 0.74rem; color: var(--accent); font-weight: 600; white-space: nowrap; }

.week-slider-container { flex: 1; display: flex; align-items: center; gap: 1rem; }
.week-slider { flex: 1; appearance: none; -webkit-appearance: none; height: 3px; border-radius: 2px; background: var(--hair-2); outline: none; cursor: pointer; }
.week-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--ivory); box-shadow: var(--shadow); cursor: grab; transition: transform 0.15s;
}
.week-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.week-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ivory); box-shadow: var(--shadow); cursor: grab; }
.slider-tooltip {
  position: fixed; top: 0; left: 0; transform: translate(-50%, -100%); margin-top: -10px;
  background: var(--ink); color: var(--ivory); font-size: 0.72rem; font-weight: 500; padding: 5px 10px;
  border-radius: var(--r-sm); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 300;
  font-variant-numeric: tabular-nums;
}
.slider-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.slider-tooltip.visible { opacity: 1; }

/* ---- Podium (Top 3) ---- */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.leader-card {
  position: relative; background: var(--ivory); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem; overflow: hidden; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 1.1rem;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.3s;
}
.leader-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--hair-2); }
.leader-card .rib { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--hair-2); }
.leader-card.is-1 { border-color: color-mix(in oklab, var(--gold) 40%, var(--hair)); }
.leader-card.is-1 .rib { background: linear-gradient(90deg, var(--gold), #ddb35a); }
.leader-card.is-2 .rib { background: linear-gradient(90deg, var(--silver), #b9bbc0); }
.leader-card.is-3 .rib { background: linear-gradient(90deg, var(--bronze), #cf9263); }

.leader-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.leader-rankwrap { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.leader-medal {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--f-serif); font-weight: 500; font-size: 0.95rem; color: #fff; flex-shrink: 0;
}
.medal-1 { background: linear-gradient(140deg, #ddb35a, #b8902f); }
.medal-2 { background: linear-gradient(140deg, #c2c4c9, #8a8d94); }
.medal-3 { background: linear-gradient(140deg, #d29161, #b06a32); }
.leader-name { font-family: var(--f-serif); font-weight: 600; font-size: 1.32rem; letter-spacing: -0.022em; line-height: 1.1; }
.leader-delta { font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Totaalrendement rechtsboven (i.p.v. het grote middenblok) */
.leader-total-top { font-family: var(--f-serif); font-weight: 600; font-size: 1.55rem; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }

.leader-total { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.leader-total .big { font-family: var(--f-serif); font-weight: 400; font-variation-settings: "opsz" 144; font-size: 2.6rem; letter-spacing: -0.03em; line-height: 0.9; font-variant-numeric: tabular-nums; }
.leader-total .lbl { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); font-weight: 600; }

.leader-pos { display: flex; gap: 0.6rem; }
.leader-chip {
  flex: 1; display: flex; align-items: center; gap: 0.5rem; min-width: 0;
  background: var(--paper-soft); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 0.5rem 0.6rem;
}
.leader-chip .side { font-size: 0.56rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.leader-chip.long .side { color: var(--up); }
.leader-chip.short .side { color: var(--down); }
.leader-chip .tk { font-size: 0.76rem; font-weight: 600; color: var(--ink); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---- Logos & monograms ---- */
.logo-wrap { position: relative; display: inline-grid; width: 24px; height: 24px; flex-shrink: 0; }
.logo-wrap .mono-badge, .logo-wrap .logo-badge { position: absolute; inset: 0; }
.logo-badge { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; background: #fff; border: 1px solid var(--hair); padding: 1px; }
.mono-badge {
  width: 24px; height: 24px; border-radius: 6px; display: inline-grid; place-items: center;
  font-size: 0.58rem; font-weight: 700; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--hair);
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}

/* ---- Weekly highlights ---- */
.highlights-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.highlight-card {
  position: relative; background: var(--ivory); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.4rem; overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.3s var(--ease);
}
.highlight-card:hover { box-shadow: var(--shadow); border-color: var(--hair-2); transform: translateY(-3px); }
.highlight-icon { position: absolute; top: 1.25rem; right: 1.4rem; font-size: 1.2rem; line-height: 1; opacity: 0.85; }
.highlight-bull .highlight-icon { color: var(--up); }
.highlight-bear .highlight-icon { color: var(--down); }
.highlight-instrument .highlight-icon { color: var(--accent); }
.highlight-label { font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-mute); display: inline-flex; align-items: center; gap: 9px; }
.highlight-label::before { content: ""; width: 18px; height: 1.5px; background: var(--accent); }
.highlight-name { font-family: var(--f-serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); line-height: 1.15; letter-spacing: -0.018em; margin-top: 0.15rem; }
.highlight-instrument-detail { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.15rem; }
.highlight-value { font-family: var(--f-serif); font-weight: 400; font-size: 2rem; letter-spacing: -0.02em; margin-top: 0.3rem; font-variant-numeric: tabular-nums; line-height: 1; }
.highlight-value.positive { color: var(--up); }
.highlight-value.negative { color: var(--down); }

/* ---- Leaderboard ---- */
.table-wrapper { background: var(--ivory); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.leaderboard { width: 100%; border-collapse: collapse; }
.leaderboard thead th {
  background: transparent; font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-mute); text-align: left; white-space: nowrap; padding: 1rem 1.1rem; border-bottom: 1px solid var(--hair);
}
.leaderboard thead th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
.leaderboard thead th.sortable:hover { color: var(--ink); }
.leaderboard thead th.active-sort { color: var(--accent); }
.leaderboard thead th.active-sort::after { content: " ↓"; }

.leaderboard tbody tr { border-bottom: 1px solid var(--hair); transition: background 0.18s; }
.leaderboard tbody tr:last-child { border-bottom: none; }
.leaderboard tbody tr:hover { background: var(--paper-soft); }
.leaderboard tbody td { padding: 0.85rem 1.1rem; white-space: nowrap; vertical-align: middle; }

.col-rank { width: 3rem; text-align: center; }
.rank-cell { text-align: center; font-weight: 600; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.rank-medal { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; font-family: var(--f-serif); font-weight: 500; font-size: 0.78rem; color: #fff; }
.rank-medal-1 { background: linear-gradient(140deg, #ddb35a, #b8902f); }
.rank-medal-2 { background: linear-gradient(140deg, #c2c4c9, #8a8d94); }
.rank-medal-3 { background: linear-gradient(140deg, #d29161, #b06a32); }

.col-change { width: 3.4rem; text-align: center; }
.change-cell { text-align: center; font-size: 0.78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.change-up { color: var(--up); }
.change-down { color: var(--down); }
.change-same { color: var(--ink-mute); }

.col-name { min-width: 12rem; }
.name-cell { font-weight: 500; }
.name-link { font-family: var(--f-serif); font-weight: 500; font-size: 1.06rem; color: var(--ink); letter-spacing: -0.01em; border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.name-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.switch-badge {
  display: inline-block; font-size: 0.56rem; font-weight: 700; color: var(--accent); background: var(--accent-soft);
  padding: 0.14em 0.45em; border-radius: 5px; margin-left: 0.5rem; vertical-align: middle; cursor: help; letter-spacing: 0.04em;
}

.col-long, .col-short { min-width: 9.5rem; }
.position-cell { display: flex; align-items: center; gap: 0.6rem; }
.position-info { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.position-ticker { font-size: 0.64rem; font-weight: 600; color: var(--ink-mute); letter-spacing: 0.03em; }
.position-return { font-weight: 600; font-size: 0.92rem; font-variant-numeric: tabular-nums; }

.col-total { min-width: 6rem; }
.total-cell { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.col-week { min-width: 5rem; }
.week-cell { font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.positive { color: var(--up); }
.negative { color: var(--down); }
.neutral { color: var(--ink-mute); }

/* ---- Chart ---- */
.chart-card { background: var(--ivory); border: 1px solid var(--hair); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.chart-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.3rem 1.5rem; border-bottom: 1px solid var(--hair); }
.chart-container { position: relative; height: clamp(320px, 46vh, 470px); padding: 1.3rem 1.5rem 1.5rem; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--hair); margin-top: auto; padding: 2rem var(--gutter); text-align: center; background: var(--paper-2); position: relative; z-index: 2; }
.footer p { font-size: 0.78rem; letter-spacing: 0.04em; color: var(--ink-mute); }

/* ---- Switch tooltip ---- */
.tooltip { position: absolute; z-index: 400; background: var(--ivory); color: var(--ink); border: 1px solid var(--hair-2); border-radius: var(--r); padding: 0.9rem 1rem; font-size: 0.82rem; box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; }
.tooltip-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin-bottom: 0.3rem; }
.tooltip > div { line-height: 1.5; }

/* ---- Loading ---- */
.loading { text-align: center; padding: 5rem 1rem; color: var(--ink-soft); font-family: var(--f-serif); font-size: 1.3rem; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .podium { grid-template-columns: 1fr; }
  .highlights-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* ---- Masthead: strak gestapeld op mobiel ---- */
  .masthead { padding: 8px 10px 0; }
  .masthead-inner {
    flex-wrap: wrap; row-gap: 9px; gap: 10px;
    padding: 9px 12px; border-radius: var(--r-lg);
    justify-content: space-between; align-items: center;
  }
  .brand { flex-shrink: 0; }
  .brand .seal { width: 30px; height: 30px; }
  .wordmark .name { font-size: 1.12rem; }
  .masthead-right { flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; }
  /* pool-switch op een eigen, gecentreerde rij onder de merknaam */
  .pool-switch { order: 5; flex-basis: 100%; justify-content: center; }
  .last-updated { display: none; }

  /* Iets minder lucht in de content op mobiel */
  .scrubber { flex-direction: column; align-items: stretch; gap: 1rem; }
  .scrubber-label { flex-direction: row; align-items: baseline; gap: 0.6rem; justify-content: space-between; }
  .section-title { font-size: 1.6rem; }
  .chart-container { height: clamp(220px, 50vh, 300px); }

  /* ---- Ranglijst: kaart-rijen (12-koloms grid) i.p.v. brede tabel ---- */
  .leaderboard { min-width: 0; width: 100%; }
  .leaderboard thead { display: none; }
  .leaderboard tbody { display: block; }
  .leaderboard tbody tr {
    display: grid; grid-template-columns: repeat(12, 1fr);
    column-gap: 6px; row-gap: 9px; align-items: center;
    padding: 13px 12px; border-top: 1px solid var(--hair);
  }
  .leaderboard tbody tr:first-child { border-top: none; }
  .leaderboard tbody td { padding: 0; border: none; min-width: 0; }
  .leaderboard .change-cell { display: none; }
  .leaderboard .rank-cell { grid-column: 1 / 3; grid-row: 1; font-weight: 700; }
  .leaderboard .name-cell { grid-column: 3 / 10; grid-row: 1; min-width: 0; }
  .leaderboard .name-cell .name-link { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
  .leaderboard .total-cell { grid-column: 10 / 13; grid-row: 1; text-align: right; font-size: 1.18rem; font-weight: 600; font-variant-numeric: tabular-nums; }
  .leaderboard .long-cell  { grid-column: 1 / 5; grid-row: 2; min-width: 0; }
  .leaderboard .short-cell { grid-column: 5 / 9; grid-row: 2; min-width: 0; }
  .leaderboard .week-cell  { grid-column: 9 / 13; grid-row: 2; text-align: right; font-variant-numeric: tabular-nums; }
  /* mini-label boven long/short/week zodat de tweede regel leesbaar is */
  .leaderboard .long-cell::before,
  .leaderboard .short-cell::before,
  .leaderboard .week-cell::before {
    content: attr(data-pos);
    display: block; font-size: 9px; line-height: 1; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--ink-mute); font-weight: 700; margin-bottom: 4px;
  }
  .leaderboard .position-cell { gap: 7px; }
}

/* ============================================================
   Bulls & Bears: zelfde stijl als WK — achtergrondfoto + frosted glass
   ============================================================ */
.app-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("../img/bb-bg.jpg") center center / cover no-repeat;
  opacity: 0.16;
}
/* compacter: minder lucht tussen secties + kleinere grafiek */
[data-density="compact"] .main { padding-top: clamp(1rem, 2.4vw, 1.7rem); padding-bottom: 2.2rem; gap: clamp(1.05rem, 2.4vw, 1.7rem); }
[data-density="compact"] .section { gap: 0.85rem; }
[data-density="compact"] .chart-container { height: clamp(240px, 36vh, 360px); padding: 1rem 1.2rem 1.2rem; }
[data-density="compact"] .section-title { font-size: clamp(1.35rem, 2.2vw, 1.8rem); }
/* compacter: strakkere kaarten + kleinere typografie */
[data-density="compact"] .podium { gap: 0.85rem; }
[data-density="compact"] .leader-card { padding: 0.95rem 1.05rem; gap: 0.7rem; }
[data-density="compact"] .leader-name { font-size: 1.12rem; }
[data-density="compact"] .leader-total .big { font-size: 2rem; }
[data-density="compact"] .highlight-card { padding: 0.95rem 1.05rem; }
[data-density="compact"] .highlight-name { font-size: 1.02rem; margin-top: 0.1rem; }
[data-density="compact"] .highlight-value { font-size: 1.55rem; margin-top: 0.2rem; }
[data-density="compact"] .highlights-grid,
[data-density="compact"] .podium { gap: 0.85rem; }
[data-density="compact"] .scrubber { padding: 0.7rem 1.1rem; }
[data-density="compact"] .section-head { gap: 0.6rem; }
/* iets donkerdere secundaire tekst voor contrast over de foto */
.app { --ink-soft: #33403c; --ink-mute: #586460; }
.app .section-title { text-shadow: 0 1px 10px rgba(252, 252, 249, 0.7); }

/* frosted-glass balken/kaarten, net als op de WK-pagina */
.app .scrubber,
.app .table-wrapper,
.app .chart-card,
.app .highlight-card,
.app .leader-card,
.app .detail-position-card,
.app .detail-hero {
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
}
