/* casualdata daily — the shared frame for one-screen visualizations.
   Brand rule: a black page, light ink, and one red thing. Red marks the single point
   that matters in each piece (and the dot in the logo). Never red text. */

@font-face {
	font-family: "Host Grotesk";
	src: url("/fonts/host-grotesk-latin.woff2") format("woff2");
	font-weight: 300 800;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: "Host Grotesk";
	src: url("/fonts/host-grotesk-latin-ext.woff2") format("woff2");
	font-weight: 300 800;
	font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* IoskeleyMono (OFL-1.1, fonts/OFL-IoskeleyMono.txt), subset to latin + latin-ext */
@font-face {
	font-family: "Ioskeley Mono";
	src: url("/fonts/ioskeley-mono-regular.woff2") format("woff2");
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: "Ioskeley Mono";
	src: url("/fonts/ioskeley-mono-bold.woff2") format("woff2");
	font-weight: 700;
	font-display: swap;
}

/* The page is white by day and black by night, by the reader's local hour
   (kit/theme.js sets data-theme on <html> before the page paints). */
:root {
	/* day: white page */
	--paper: #FFFFFF;
	--ink: #121212;
	--ink-2: #5A5853;   /* secondary text, 7.2:1 on white */
	--ink-3: #8E8B84;   /* rules and axis ticks only; 3:1 on white for chart marks */
	--rule: #E6E4DF;
	--red: #FF3D1F;     /* the one thing. marks only, never text */
	--sans: "Host Grotesk", Arial, sans-serif;
	--mono: "Ioskeley Mono", ui-monospace, "SF Mono", Menlo, monospace;
	--gut: clamp(16px, 2.4vw, 36px);
	color-scheme: light;
}
:root[data-theme="dark"] {
	/* night: black page */
	--paper: #0E0E0E;
	--ink: #EDEBE6;
	--ink-2: #A8A59E;   /* 8.1:1 on the page */
	--ink-3: #66635E;
	--rule: #2A2927;
	color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--paper);
	color: var(--ink);
	font: 400 16px/1.4 var(--sans);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- the mark ---------- */
/* {casual: data} is the name; {●} is the symbol (favicon, stamps, tight spaces) */
.cd-mark { display: inline-flex; align-items: center; text-decoration: none; flex: none; }
.cd-mark img { height: 20px; width: auto; display: block; }
/* two wordmark files, one per theme: .wm-d for the black page, .wm-l for the white one */
.cd-mark .sym { display: none; }
:root[data-theme="dark"] .wm-l, :root:not([data-theme="dark"]) .wm-d { display: none; }
@media (max-width: 400px) { .cd-mark .wm { display: none !important; } .cd-mark .sym { display: block; } }

.cd-meta { font: 400 12px/1.3 var(--mono); letter-spacing: .02em; color: var(--ink-2); text-transform: uppercase; }
.cd-meta b { font-weight: 400; color: var(--ink); }

/* ---------- one-screen stage ---------- */
body.cd-day {
	height: 100dvh; overflow: hidden;
	display: grid; grid-template-rows: auto auto 1fr auto; grid-template-columns: minmax(0, 1fr);
}
.cd-bar {
	display: flex; align-items: center; gap: 20px;
	padding: 14px var(--gut);
	border-bottom: 1px solid var(--ink);
}
.cd-bar .cd-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-actions { display: flex; gap: 8px; }
.cd-btn {
	appearance: none; border: 1px solid var(--ink); background: transparent;
	border-radius: 999px; padding: 7px 14px; cursor: pointer;
	font: 400 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
	display: inline-flex; align-items: center; gap: 8px;
}
.cd-btn:hover { background: var(--ink); color: var(--paper); }
.cd-btn.solid { background: var(--ink); color: var(--paper); }
.cd-btn.solid:hover { background: transparent; color: var(--ink); }

/* The head is two things: the title, and one or two sentences that say how to
   read the chart. The reading itself lives in the chart (CD.label). */
.cd-head {
	display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px 48px; align-items: end;
	padding: clamp(16px, 3vh, 36px) var(--gut) clamp(14px, 2.4vh, 26px);
}
.cd-title {
	/* light on purpose: 800 belongs to the wordmark alone */
	margin: 0; font-weight: 400; letter-spacing: -.025em; line-height: 1;
	font-size: clamp(28px, min(4.4vw, 6.6vh), 72px);
	max-width: 18ch; text-wrap: balance;
}
.cd-dek { margin: 0; max-width: 44ch; justify-self: end; color: var(--ink-2); font-size: clamp(14px, 1.2vw, 16px); line-height: 1.45; text-wrap: pretty; }

.cd-stage { position: relative; min-height: 0; margin: 0 var(--gut); }
.cd-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

.cd-foot {
	display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
	padding: 10px var(--gut) 14px;
}
.cd-foot a { text-decoration-color: var(--ink-3); text-underline-offset: 3px; }

@media (max-width: 720px) {
	.cd-head { grid-template-columns: 1fr; }
	.cd-foot .hint { display: none; }
	.cd-dek { justify-self: start; font-size: 14px; }
	.cd-bar { gap: 12px; }
	.cd-bar .cd-meta .long { display: none; }
	.cd-btn .label { display: none; }
	.cd-btn { padding: 8px 10px; }
}

/* ---------- panels: menu + share ---------- */
dialog.cd-panel {
	border: 0; padding: 0; margin: 0 0 0 auto; height: 100dvh; max-height: none;
	width: min(420px, 100vw); background: var(--paper); color: var(--ink);
	border-left: 1px solid var(--ink);
}
dialog.cd-panel::backdrop { background: rgb(0 0 0 / .6); }
.cd-panel .in { padding: 14px var(--gut) 32px; display: grid; gap: 28px; }
.cd-panel .top { display: flex; justify-content: space-between; align-items: center; }
.cd-panel h2 { margin: 0 0 10px; font: 400 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.cd-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.cd-list li { border-bottom: 1px solid var(--rule); }
.cd-list a, .cd-list button {
	display: grid; grid-template-columns: 4.2em 1fr; gap: 12px; align-items: baseline;
	padding: 12px 0; text-decoration: none; width: 100%; text-align: left;
	background: none; border: 0; cursor: pointer; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
}
.cd-list a:hover, .cd-list button:hover { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.cd-list .n { font: 400 12px/1 var(--mono); color: var(--ink-2); }
.cd-list [aria-current] .n::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; }
.cd-panel p { margin: 0; color: var(--ink-2); }
.cd-toast {
	position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
	background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px;
	font: 400 12px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
	transition: .2s; pointer-events: none; z-index: 10;
}
.cd-toast.on { opacity: 1; transform: translate(-50%, 0); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
