/* Shared styles for macro/, macro/flows/ and macro/ipo/, on top of ../style.css.
   Series colours are the eight categorical slots of the site's chart palette
   (the same tokens as mock_trading/), up/down follow the site's blue/orange. */
:root {
	--maxw: 1120px;
	--viz-surface: #ffffff;
	--viz-grid:    #ece9e3;
	--viz-axis:    #b9b3a8;
	--viz-ink-1:   #232323;
	--viz-ink-2:   #52514e;
	--viz-ink-3:   #6b6862;
	--viz-up:      #2a78d6;
	--viz-down:    #d95926;
	--s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
	--s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--viz-surface: #1f1e1b; --viz-grid: #302d28; --viz-axis: #5d574e;
		--viz-ink-1: #eae7e1; --viz-ink-2: #c0bbb2; --viz-ink-3: #a29d94;
		--viz-up: #3987e5; --viz-down: #eb6834;
		--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
		--s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
	}
}
:root[data-theme="dark"] {
	color-scheme: dark;
	--viz-surface: #1f1e1b; --viz-grid: #302d28; --viz-axis: #5d574e;
	--viz-ink-1: #eae7e1; --viz-ink-2: #c0bbb2; --viz-ink-3: #a29d94;
	--viz-up: #3987e5; --viz-down: #eb6834;
	--s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
	--s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

header.hero { padding: 3.5rem 0 2rem; }
.breadcrumb { font-size: .88rem; color: var(--text-muted); margin: 0 0 1.2rem; }
.breadcrumb a + a { margin-left: .8rem; }
.breadcrumb .langbtn { float: right; margin-top: -.15rem; }
header.hero .subtitle { margin: .6rem 0 0; color: var(--text-muted); font-size: 1.02rem; max-width: 46rem; }
header.hero .status { margin: .9rem 0 0; font-size: .88rem; color: var(--text-muted); }
header.hero .status strong { color: var(--text); font-weight: 600; }
section { padding: 2.2rem 0; }
code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; background: var(--accent-soft); padding: .1em .35em; border-radius: 4px; }

.callout { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: .9rem 1.1rem; margin: 0 0 1rem; font-size: .92rem; }
.callout p:last-child { margin-bottom: 0; }

/* Tiles */
.tile-group { margin: 0 0 1.1rem; }
.tile-group h3 { margin: 0 0 .45rem; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--sans); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .55rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .55rem .7rem .45rem; cursor: pointer; text-align: left; font: inherit; color: inherit; display: block; width: 100%; }
.tile:hover, .tile[aria-pressed="true"] { border-color: var(--accent); }
.tile .nm { font-size: .8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .lv { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: .05rem 0 0; }
.tile .ch { font-size: .8rem; font-variant-numeric: tabular-nums; }
.tile .dt { font-size: .7rem; color: var(--text-muted); float: right; margin-top: .15rem; }
.tile svg { display: block; width: 100%; height: 26px; margin-top: .2rem; }
.tile svg path { fill: none; stroke: var(--viz-ink-3); stroke-width: 1.5; }
.up { color: var(--viz-up); }
.down { color: var(--viz-down); }

/* Filters and buttons */
.filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .86rem; margin: 0 0 .8rem; color: var(--text-muted); }
.filters .group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.filters select { font: inherit; font-size: .86rem; padding: .2rem .4rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; max-width: 100%; }
.btn { font: inherit; font-size: .8rem; padding: .24rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--accent); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.legend { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin: 0 0 .6rem; padding: 0; list-style: none; }
.legend li { margin: 0; font-size: .82rem; display: inline-flex; align-items: center; gap: .4rem; }
.legend .lk { display: inline-block; width: 1.3em; height: 0; border-top: 2px solid var(--sc); }
.legend .sq { display: inline-block; width: .8em; height: .8em; border-radius: 2px; background: var(--sc); }
.legend button { font: inherit; font-size: .8rem; border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 0 .2rem; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 0 1.2rem; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem .9rem; margin: 0 0 1.1rem; min-width: 0; }
.chart-card h3 { margin: 0 0 .15rem; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--sans); }
.chart-card .sub { margin: 0 0 .55rem; font-size: .8rem; color: var(--text-muted); }
.chart-card .src { margin: .4rem 0 0; font-size: .74rem; color: var(--text-muted); }
svg.ts { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
svg.ts text { font-family: var(--sans); font-size: 11px; fill: var(--viz-ink-3); }
svg.ts .xlab { text-anchor: middle; }
svg.ts .ylab { text-anchor: end; }
svg.ts line.grid { stroke: var(--viz-grid); stroke-width: 1; }
svg.ts line.base { stroke: var(--viz-axis); stroke-width: 1; }
svg.ts path.ln { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
svg.ts text.dlab { fill: var(--text); font-size: 11px; }
svg.ts line.hover { stroke: var(--viz-axis); }
svg.ts circle.hover { stroke: var(--viz-surface); stroke-width: 2; }
svg.ts line.ev { stroke: var(--viz-axis); stroke-dasharray: 2 3; }
svg.ts path.evm { stroke: var(--viz-surface); stroke-width: 1; }
svg.ts rect.bar-up { fill: var(--viz-up); }
svg.ts rect.bar-down { fill: var(--viz-down); }

.tablewrap { overflow-x: auto; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
table.rec { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 0 0 .5rem; }
table.rec th, table.rec td { text-align: left; padding: .38rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.rec th { font-weight: 600; color: var(--text-muted); font-size: .74rem; letter-spacing: .04em; }
table.rec th[data-k] { cursor: pointer; }
table.rec th[aria-sort] { color: var(--text); }
table.rec .num { text-align: right; font-variant-numeric: tabular-nums; }
table.rec td.name { font-weight: 600; }
table.rec td.wrap { white-space: normal; min-width: 16rem; }
table.rec td.pos { background: color-mix(in srgb, var(--viz-up) calc(var(--k) * 1%), transparent); }
table.rec td.neg { background: color-mix(in srgb, var(--viz-down) calc(var(--k) * 1%), transparent); }
table.rec td.name:first-child, table.rec th:first-child { position: sticky; left: 0; background: var(--bg); z-index: 1; }

.badge { display: inline-block; font-size: .7rem; padding: .05rem .45rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; font-weight: 500; }
.badge.cut { color: var(--viz-up); border-color: var(--viz-up); }
.badge.hike { color: var(--viz-down); border-color: var(--viz-down); }

ul.news { list-style: none; padding: 0; margin: 0; }
ul.news li { padding: .45rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
ul.news .meta { font-size: .74rem; color: var(--text-muted); margin-right: .4rem; font-variant-numeric: tabular-nums; }
ul.news .tp { font-size: .7rem; margin-right: .35rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: .8rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem; min-width: 0; }
.card h4 { margin: 0; font-size: 1rem; font-family: var(--sans); }
.card .meta { font-size: .78rem; color: var(--text-muted); margin: .15rem 0 .45rem; }
.card p { font-size: .86rem; margin: .3rem 0; }
.card ul { padding-left: 1.1rem; margin: .3rem 0 0; font-size: .82rem; }
.card li { margin: .2rem 0; }
.heatbar { height: 6px; border-radius: 3px; background: var(--viz-grid); overflow: hidden; margin: .35rem 0 .1rem; }
.heatbar > span { display: block; height: 100%; background: var(--accent); }

.method ul { padding-left: 1.2rem; margin: 0 0 1rem; font-size: .9rem; }
.method li { margin: .25rem 0; }

#tooltip { position: fixed; pointer-events: none; z-index: 10; background: var(--viz-ink-1); color: var(--viz-surface); font-size: .78rem; line-height: 1.4; padding: .35rem .55rem; border-radius: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); max-width: 90vw; }
#tooltip[hidden] { display: none; }
#tooltip .row { display: flex; justify-content: space-between; gap: 1rem; }
#tooltip .row .lk { display: inline-block; width: .9em; height: 0; border-top: 2px solid var(--sc); vertical-align: middle; margin-right: .35rem; }
#tooltip .row .v { font-weight: 600; }
#tooltip .d { color: var(--viz-axis); margin-bottom: .15rem; }
#tooltip .ev { white-space: normal; max-width: 18rem; }

.error { color: var(--viz-down); }
.muted { color: var(--text-muted); }
.small { font-size: .8rem; }
.loading { color: var(--text-muted); font-style: italic; }

@media (max-width: 560px) {
	.wrap { padding: 0 1rem; }
	.hero h1 { font-size: 1.9rem; }
	.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
