/* ==========================================================================
   Right-Now widgets — ported from heliumhome's style.css and adapted to the
   folium default theme's tokens, so it tracks light/dark via
   prefers-color-scheme (no backdrop blur: the blog page has a flat --bg).
   Only the selectors the blog's widgets actually emit are kept.
   ========================================================================== */

:root {
	--faint: color-mix(in srgb, var(--muted) 60%, transparent);
	--accent-2: color-mix(in oklab, var(--accent) 55%, #c9b6ff);
	--glass-tint: var(--surface);
	--glass-tint-2: var(--surface-2);
	--glass-edge: var(--border);
	--glass-edge-soft: var(--border);
	--radius: 16px;
	--radius-sm: 10px;
	--gap: 14px;
}

* {
	box-sizing: border-box;
}

p { margin: 0; }

/* Article body: restore paragraph flow spacing (browser default is 1em). */
.post p { margin: 1em 0; }
.post > p:first-of-type,
.post-header + * { margin-top: 0; }

img { max-width: 100%; height: auto; }

pre,
code,
.md .md-code,
.md .md-pre {
	tab-size: 4;
	-moz-tab-size: 4;
}

.muted { color: var(--muted); }

.eyebrow {
	font-size: 10px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	margin: 0 0 6px;
	flex: none;
}

/* consistent icon sizing */
.icn {
	width: 18px;
	height: 18px;
	flex: none;
	display: inline-block;
	vertical-align: -0.22em;
}

.icn-xxs { width: 10px; height: 10px; stroke-width: 2.2; }
.icn-xs { width: 13px; height: 13px; stroke-width: 2; }
.icn-sm { width: 16px; height: 16px; }
.icn-xl { width: 46px; height: 46px; stroke-width: 1.25; }

.scroll-area {
	overflow-y: auto;
	overscroll-behavior: contain;
	min-height: 0;
	scrollbar-width: thin;
	scrollbar-color: var(--glass-edge-soft) transparent;
}

.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-track { background: transparent; }
.scroll-area::-webkit-scrollbar-thumb {
	background: color-mix(in srgb, var(--muted) 35%, transparent);
	border-radius: 999px;
}

/* ================================
   shared card primitive
   ================================ */

.discord-account,
.current-weather,
.now-playing,
.recent-tracks,
.np-lyrics-subbox,
.phone {
	position: relative;
	background: var(--glass-tint);
	border: 1px solid var(--glass-edge-soft);
	border-top-color: var(--glass-edge);
	border-radius: var(--radius);
	box-shadow:
		0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent) inset,
		0 14px 40px rgba(10, 4, 20, 0.12);
	overflow: hidden;
	isolation: isolate;
}

/* nested chips read lighter so they don't turn to mud */
.wx-stat,
.wx-hour,
.guild,
.connection,
.activity-card,
.act-btn,
.track-art-fallback,
.np-art-fallback {
	background: var(--glass-tint-2);
	border: 1px solid var(--glass-edge-soft);
}

/* ================================
   weather
   ================================ */

.current-weather {
	padding: 12px 16px 13px;
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.wx-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.wx-top .eyebrow { margin: 0; }

.wx-hilo {
	display: flex;
	align-items: center;
	gap: 3px;
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	color: var(--muted);
}

.wx-hilo .icn-xs { margin-left: 6px; }
.wx-hilo .icn-xs:first-child { margin-left: 0; }

.wx-hero {
	display: flex;
	align-items: center;
	gap: 14px;
}

.wx-glyph {
	color: var(--accent);
	line-height: 0;
}

.wx-hero-text { min-width: 0; }

.temp {
	font-size: 2.6rem;
	font-weight: 300;
	line-height: 0.95;
	letter-spacing: -0.035em;
	font-variant-numeric: tabular-nums;
	color: var(--fg);
}

.temp .deg {
	font-size: 0.9rem;
	font-weight: 400;
	letter-spacing: 0;
	color: var(--muted);
	margin-left: 2px;
	vertical-align: 0.9em;
}

.wx-desc {
	font-size: 0.86rem;
	font-weight: 500;
	margin-top: 4px;
	text-transform: lowercase;
}

.wx-feels {
	font-size: 0.72rem;
	line-height: 1.3;
}

.wx-hours {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 5px;
	flex: none;
}

.wx-hour {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	padding: 7px 2px 6px;
	border-radius: 12px;
	color: var(--accent);
}

.wx-hour-pop {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 9.5px;
	font-variant-numeric: tabular-nums;
	color: var(--faint);
	line-height: 1;
}

.wx-hour-pop.is-wet { color: #8ec5ff; }

.wx-hour-t {
	font-size: 9.5px;
	letter-spacing: 0.06em;
	font-variant-numeric: tabular-nums;
}

.wx-hour-deg {
	font-size: 0.76rem;
	font-weight: 500;
	color: var(--fg);
	font-variant-numeric: tabular-nums;
}

/* stat grid */
.wx-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 5px;
	flex: none;
}

.wx-stat {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 6px 8px;
	border-radius: 12px;
	min-width: 0;
}

.wx-stat-icn { color: var(--accent-2); }

.wx-stat-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.wx-k {
	font-size: 9px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}

.wx-v {
	font-size: 0.8rem;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* daylight track */
.wx-sun {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--glass-edge-soft);
	font-size: 0.7rem;
	font-variant-numeric: tabular-nums;
	color: var(--muted);
	margin-top: auto;
}

.wx-sun-t {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	flex: none;
}

.wx-track {
	position: relative;
	flex: 1;
	height: 3px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--muted) 20%, transparent);
	overflow: visible;
}

.wx-track-fill {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 999px;
	background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 40%, transparent), var(--accent));
}

.wx-track-fill::after {
	content: "";
	position: absolute;
	right: -3px;
	top: 50%;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--fg);
	transform: translateY(-50%);
	box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* ================================
   now playing
   ================================ */

.now-playing-wrapper {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.now-playing {
	display: flex;
	flex-direction: column;
	gap: 11px;
	padding: 13px 15px;
	width: 100%;
}

.now-playing.has-lyrics {
	border-bottom-left-radius: var(--radius-sm);
	border-bottom-right-radius: var(--radius-sm);
}

.now-playing.idle {
	align-items: center;
	justify-content: center;
	font-size: 0.86rem;
	min-height: 74px;
}

.np-main {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	min-width: 0;
}

.np-art { position: relative; flex-shrink: 0; }

.np-art img,
.np-art-fallback {
	width: 48px;
	height: 48px;
	border-radius: 10px;
	display: block;
	object-fit: cover;
	box-shadow: 0 6px 16px rgba(10, 4, 20, 0.2);
}

.np-art-fallback {
	color: var(--muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.2rem;
}

.np-info { min-width: 0; flex: 1; }

.np-track,
.np-artist,
.np-album {
	max-width: 100%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.np-track { font-size: 0.9rem; font-weight: 600; }

.np-artist {
	font-size: 0.78rem;
	color: var(--muted);
	margin-top: 1px;
}

.np-album {
	font-size: 0.72rem;
	color: var(--faint);
	margin-top: 1px;
}

/* scrubber driven locally from started_playing + duration */
.np-progress {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 0.64rem;
	font-variant-numeric: tabular-nums;
	color: var(--faint);
}

.np-bar {
	position: relative;
	flex: 1;
	height: 3px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--muted) 20%, transparent);
}

.np-bar-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: 999px;
	background: var(--accent-2);
	transition: width 0.9s linear;
}

.np-state {
	color: var(--muted);
	line-height: 0;
	flex: none;
}

.now-playing.is-paused .np-art img,
.now-playing.is-paused .np-art-fallback { opacity: 0.6; }

.now-playing.is-paused .np-bar-fill { background: var(--muted); }

.eq {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	height: 14px;
	flex: none;
}

.eq span {
	width: 3px;
	background: var(--accent-2);
	border-radius: 2px;
	animation: eq 1s ease-in-out infinite;
}

.eq span:nth-child(1) { animation-delay: 0s; }
.eq span:nth-child(2) { animation-delay: 0.2s; }
.eq span:nth-child(3) { animation-delay: 0.4s; }
.eq span:nth-child(4) { animation-delay: 0.1s; }

.np-lyrics-subbox {
	width: 90%;
	margin-top: -1px;
	border-top: none;
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	padding: 6px 12px;
	font-size: 0.7rem;
	text-align: center;
	flex: none;
}

/* the static iframe fallback before JS takes over */
.now-playing-wrapper iframe { width: 100%; max-width: 100%; }

/* ================================
   recent tracks
   ================================ */

.recent-tracks {
	padding: 12px 8px 13px 15px;
	display: flex;
	flex-direction: column;

	/* 20 are fetched; the list is clipped to 5 rows and scrolls for the rest */
	--track-row: 38px;
	--track-gap: 10px;
}

.track-list {
	display: flex;
	flex-direction: column;
	gap: var(--track-gap);
	padding-right: 7px;
	/* the extra 7px is just clearance so the fade lands below the 5th row
	   instead of washing out its artist line */
	max-height: calc(5 * var(--track-row) + 4 * var(--track-gap) + 7px);
	mask-image: linear-gradient(to bottom, #000 calc(100% - 9px), transparent 100%);
}

.track-row {
	min-height: var(--track-row);
	display: flex;
	align-items: center;
	gap: 0.7rem;
}

.track-art img,
.track-art-fallback {
	width: 34px;
	height: 34px;
	border-radius: 8px;
	flex-shrink: 0;
	object-fit: cover;
	display: block;
}

.track-art-fallback {
	color: var(--muted);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
}

.track-info { min-width: 0; flex: 1; }

.track-name,
.track-artist {
	max-width: 100%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.track-name { font-size: 0.8rem; font-weight: 500; }

.track-artist { font-size: 0.74rem; color: var(--muted); }

.track-time {
	font-size: 0.68rem;
	color: var(--faint);
	flex-shrink: 0;
	white-space: nowrap;
}

/* ================================
   discord profile card
   ================================ */

.discord-profile {
	flex: 1 1 auto;
	display: flex;
	min-height: 0;
}

.discord-account {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 0;
	padding-bottom: 10px;
}

.dc-banner-wrap {
	position: relative;
	flex: none;
	height: 76px;
	overflow: hidden;
}

.banner {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border: 0;
}

.banner-empty {
	background-image: linear-gradient(135deg,
		color-mix(in oklab, var(--accent) 40%, transparent),
		color-mix(in oklab, var(--accent-2) 45%, transparent));
}

.dc-top {
	flex: none;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 0 14px;
	margin-top: -30px;
}

.pfp { position: relative; flex: none; }

.profile-image {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	display: block;
	border: 0;
	outline: 3px solid var(--bg);
	outline-offset: -1px;
	background-color: var(--glass-tint-2);
	box-shadow: 0 6px 18px rgba(10, 4, 20, 0.2);
}

.status-icon {
	height: 17px;
	width: 17px;
	position: absolute;
	bottom: 1px;
	right: 1px;
	border-radius: 50%;
	border: 3px solid var(--bg);
	z-index: 3;
}

.avatar-deco {
	height: 70px;
	width: 70px;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.dc-body {
	padding: 6px 14px 0;
	min-height: 0;
	mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent 100%);
}

.badges { display: flex; gap: 4px; margin-bottom: 4px; }
.badge { width: 18px; height: 18px; }

.global_name {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex-wrap: wrap;
}

.global_name p {
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.guild {
	border-radius: 8px;
	padding: 1px 6px;
	display: flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 10.5px;
	color: var(--muted);
}

.guild img { height: 12px; width: 12px; }

.username {
	color: var(--muted);
	font-size: 0.78rem;
	line-height: 1.3;
}

.discord-account .eyebrow {
	margin-top: 10px;
	margin-bottom: 3px;
}

.about-me {
	font-size: 0.8rem;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

.custom-status {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 5px;
	font-size: 0.78rem;
	line-height: 1.35;
	color: var(--fg);
}

.cs-emoji {
	width: 16px;
	height: 16px;
	flex: none;
	display: block;
}

.cs-emoji-uni {
	font-size: 0.9rem;
	line-height: 1;
	flex: none;
}

/* ================================
   rich presence cards
   ================================ */

.activity-card {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 9px 10px;
	border-radius: 12px;
	margin-bottom: 6px;
}

.act-art {
	position: relative;
	flex: none;
}

.act-large {
	width: 56px;
	height: 56px;
	border-radius: 8px;
	object-fit: cover;
	display: block;
	background: var(--glass-tint-2);
	box-shadow: 0 4px 12px rgba(10, 4, 20, 0.2);
}

.act-large-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.3rem;
	font-weight: 600;
	color: var(--muted);
	text-transform: uppercase;
}

.act-small {
	position: absolute;
	right: -5px;
	bottom: -5px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
	background: var(--bg);
	border: 2px solid var(--bg);
	box-shadow: 0 2px 6px rgba(10, 4, 20, 0.3);
}

.act-text {
	min-width: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.act-title,
.act-line,
.act-elapsed {
	max-width: 100%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.act-title {
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.3;
}

.act-line {
	font-size: 0.74rem;
	color: var(--muted);
	line-height: 1.3;
}

.act-elapsed {
	font-size: 0.72rem;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
	margin-top: 2px;
}

.act-bar {
	position: relative;
	height: 3px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--muted) 20%, transparent);
	margin-top: 7px;
	overflow: hidden;
}

.act-bar-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: 999px;
	background: var(--accent);
}

.act-bar-times {
	display: flex;
	justify-content: space-between;
	font-size: 0.64rem;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
	margin-top: 3px;
}

.act-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	margin-top: 7px;
}

.act-btn {
	font-size: 0.7rem;
	font-weight: 500;
	padding: 3px 10px;
	border-radius: 999px;
	color: var(--fg);
	text-decoration: none;
	transition: background 0.15s ease;
}

a.act-btn:hover {
	background: color-mix(in srgb, var(--fg) 14%, transparent);
}

.connections {
	display: flex;
	flex-direction: column;
	gap: 5px;
	padding-bottom: 6px;
}

.connection {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.5rem;
	border-radius: 9px;
	padding: 4px 9px;
}

.connection .name {
	font-size: 0.78rem;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.connection .type {
	font-size: 0.7rem;
	color: var(--faint);
	flex: none;
}

/* ================================
   markdown (discord bio)
   ================================ */

.md strong { font-weight: 700; color: var(--fg); }
.md em { font-style: italic; }
.md u { text-decoration: underline; text-underline-offset: 2px; }
.md s { opacity: 0.65; }

.md .md-code {
	font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
	font-size: 0.92em;
	background: color-mix(in srgb, var(--fg) 10%, transparent);
	border: 1px solid var(--glass-edge-soft);
	border-radius: 5px;
	padding: 0.5px 4px;
}

.md .md-pre {
	font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
	font-size: 0.78rem;
	background: color-mix(in srgb, var(--fg) 10%, transparent);
	border: 1px solid var(--glass-edge-soft);
	border-radius: 8px;
	padding: 7px 9px;
	margin: 5px 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.md .md-quote {
	display: block;
	padding-left: 9px;
	border-left: 2px solid var(--glass-edge);
	color: var(--muted);
}

.md .md-emoji {
	width: 1.25em;
	height: 1.25em;
	vertical-align: -0.25em;
	display: inline-block;
}

.md .md-spoiler {
	background: color-mix(in srgb, var(--fg) 16%, transparent);
	border-radius: 4px;
	color: transparent;
	transition: color 0.15s ease;
}

.md .md-spoiler:hover {
	color: inherit;
	background: color-mix(in srgb, var(--fg) 8%, transparent);
}

/* ================================
   phone card
   ================================ */

.phone {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px 12px 14px;
	width: max-content;
	max-width: 100%;
}

.phone-art { flex: none; line-height: 0; }

.phone-svg {
	width: 40px;
	height: 74px;
	display: block;
	filter: drop-shadow(0 5px 14px rgba(10, 4, 20, 0.35));
}

.phone-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.phone-meta .eyebrow { margin-bottom: 3px; }

.phone-batt {
	display: flex;
	align-items: center;
	gap: 7px;
}

.phone-batt svg { flex: none; }

.phone-pct {
	font-size: 1rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.phone-rate {
	font-size: 0.68rem;
	white-space: nowrap;
}

.phone-temp {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 0.74rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	margin-top: 1px;
}

.phone-temp.is-warm { color: #fbbf24; }
.phone-temp.is-hot { color: #f87171; }

.phone-temp.is-fire {
	color: #ff6b3d;
	font-weight: 600;
}

.phone-temp.is-fire .icn {
	fill: rgba(255, 107, 61, 0.25);
	animation: flicker 1.6s ease-in-out infinite;
}

/* ================================
   kv / online status
   ================================ */

#kv { max-width: 100%; }

#kv p {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin: 0;
}

.pulse {
	display: block;
	background: #00b100;
	box-shadow: 0 0 10px #00d900;
	animation: pulse 2s infinite;
	aspect-ratio: 1 / 1;
	border-radius: 1000px;
	width: 12px;
	height: 12px;
}

/* ================================
   grid wrapper
   ================================ */

.widgets-grid {
	columns: 280px;
	column-gap: 20px;
}

.widgets-grid > * {
	width: 100%;
	margin-bottom: 20px;
	break-inside: avoid;
}

/* ================================
   motion
   ================================ */

@keyframes eq {
	0%, 100% { height: 3px; }
	50% { height: 14px; }
}

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

@keyframes flicker {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.75; transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
	.eq span,
	.phone-temp.is-fire .icn,
	.pulse {
		animation: none;
	}

	.np-bar-fill { transition: none; }
}
