/* Variables */
:root {
	--font-body: 'Inter', system-ui, -apple-system, sans-serif;
	--font-heading: 'Inter', system-ui, -apple-system, sans-serif;
	--font-brand: 'Inter', system-ui, -apple-system, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
	--base: #1c1f1c;
	--text-dark: #101210;
	--text-light: #4b524c;
	--text-muted: #666c65;
	--primary: #187042;
	--accent: #187042;
	--accent-soft: #e3f2e8;
	--page-grad-start: #f7f6f2;
	--page-grad-end: #f7f6f2;
	--surface: #ffffff;
	--surface-muted: #f0efe9;
	--surface-tint: rgb(247 246 242 / 90%);
	--border: #ded9cd;
	--shadow: rgb(30 30 25 / 10%);
	--header-link-hover: #101210;
	--mobile-nav-bg: #f7f6f2;
	--footer-grad-start: #f7f6f2;
	--footer-grad-end: #f7f6f2;
	--state-ok-bg: #e3f2e8;
	--state-ok-text: #187042;
	--state-warn-bg: #f7ecd2;
	--state-warn-text: #92620a;
	--state-risk-bg: #fbe4e1;
	--state-risk-text: #b3372e;

	/* Text color to use on top of --primary/--accent fills (buttons, avatars) - same in both themes */
	--on-accent: #f4fbf6;

	/* Radius scale (border-radius) - same in both themes */
	--radius-small: 4px;
	--radius-medium: 6px;
	--radius-large: 10px;
	--radius-full: 999px;
}

body[data-theme='carbon-brief'] {
	--base: #d9e4dc;
	--text-dark: #eaf3ec;
	--text-light: #a9b8b0;
	--text-muted: #77857d;
	--primary: #3ecf7a;
	--accent: #3ecf7a;
	--accent-soft: #12271a;
	--page-grad-start: #0b0f0d;
	--page-grad-end: #0b0f0d;
	--surface: #101512;
	--surface-muted: #141a17;
	--surface-tint: rgb(11 15 13 / 90%);
	--border: #223028;
	--shadow: rgb(0 0 0 / 45%);
	--header-link-hover: #eaf3ec;
	--mobile-nav-bg: #0e1310;
	--footer-grad-start: #0b0f0d;
	--footer-grad-end: #0b0f0d;
	--state-ok-bg: #12271a;
	--state-ok-text: #3ecf7a;
	--state-warn-bg: #2a2211;
	--state-warn-text: #e0b84a;
	--state-risk-bg: #2a1512;
	--state-risk-text: #e2574c;
	--on-accent: #06170d;
}

/* Reset */
* { box-sizing: border-box; }
body { margin: 0; }
input, button, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { cursor: pointer; }

/* Defaults */
body { background: linear-gradient(180deg, var(--page-grad-start) 0%, var(--page-grad-end) 100%); color: var(--base); font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6 { font-weight: 500; font-family: var(--font-heading); line-height: 1.3; margin: 0 0 0.5em; color: var(--text-dark); letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
p { margin: 0 0 1em; }
a { text-decoration: none; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

/* Layout */
.c-container { margin: 0 auto; padding: 0 16px; }
@media screen and (min-width: 576px) { .c-container { max-width: 560px; } }
@media screen and (min-width: 768px) { .c-container { max-width: 740px; } }
@media screen and (min-width: 992px) { .c-container { max-width: 980px; } }
@media screen and (min-width: 1240px) { .c-container { max-width: 1200px; } }

/* Header */
body { padding-top: 96px; }
header { position: fixed; top: 0; left: 0; width: 100%; height: 96px; z-index: 10; transition: height 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease; }
header .c-container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
body.scrolled header { height: 78px; background: var(--surface-tint); backdrop-filter: blur(7px); box-shadow: 0 10px 30px var(--shadow); }
@media screen and (max-width: 767px) {
	body { padding-top: 88px; }
	header { height: 88px; }
	body.scrolled header { height: 74px; }
}

/* Brand (logo) */
.c-brand { display: inline-flex; align-items: baseline; gap: 10px; font-family: var(--font-brand); text-transform: uppercase; letter-spacing: 0.12em; font-size: 1.05rem; font-weight: 600; }
.c-brand .dot { width: 8px; height: 8px; margin-left: 4px; margin-right: 7px; transform: translateY(-2px); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 7px var(--accent-soft); animation: c-brand-dot-pulse 3.8s ease-in-out infinite; }
.c-brand small { font-size: 0.64rem; font-weight: 700; color: var(--text-light); letter-spacing: 0.18em; }
@keyframes c-brand-dot-pulse {
	0%,
	100% {
		transform: translateY(-2px) scale(1);
		box-shadow: 0 0 0 7px var(--accent-soft);
	}
	50% {
		transform: translateY(-2px) scale(1.07);
		box-shadow: 0 0 0 9px var(--accent-soft);
	}
}
@media (prefers-reduced-motion: reduce) {
	.c-brand .dot { animation: none; }
}

/* Header */
header a { font-size: 0.9rem; }
header nav ul { display: flex; gap: 10px; align-items: center; }
header nav a { padding: 0.45em 0.8em 0.5em; border-radius: var(--radius-medium); font-weight: 500; color: var(--text-light); transition: color 0.2s ease, background-color 0.2s ease; }
header nav a:hover { color: var(--header-link-hover); background: var(--accent-soft); }
header nav .close { display: none; }
header .actions { display: flex; align-items: center; gap: 10px; }
header .mobile { display: none; }
header .themetoggle { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-medium); background: var(--surface); color: var(--text-muted); transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease; }
header .themetoggle .material-symbols-outlined { font-size: 18px; }
header .themetoggle:hover { background: var(--surface-muted); color: var(--header-link-hover); transform: translateY(-1px); }

/* Logged-in header */
header nav { flex: 1; display: flex; justify-content: center; }
header nav ul { gap: 8px; }
header nav a.is-active { color: var(--text-dark); background: var(--surface-muted); }
@media screen and (max-width: 991px) {
	body.mobile-menu-open { overflow: hidden; }
	header .mobile { display: inline-flex; padding: 10px; border: 0; background: var(--surface); color: var(--text-dark); }
	header nav { position: fixed; top: 0; right: 0; width: min(78vw, 360px); height: 100dvh; padding: 86px 24px 24px; background: var(--mobile-nav-bg); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform 0.3s ease; }
	body.mobile-menu-open header nav { transform: translateX(0); }
	header nav .close { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; padding: 0; border: 0; background: var(--surface); color: var(--header-link-hover); }
	header nav .close:hover { background: var(--accent-soft); }
	header nav .close .material-symbols-outlined { font-size: 22px; }
	header nav ul { flex-direction: column; align-items: stretch; width: 100%;}
	header nav a { display: block; font-size: 1rem; color: var(--base); }
	header .actions { display: none; }
}

/* Main */
body { min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }

/* Footer */
footer { padding: 34px 0; background: linear-gradient(145deg, var(--footer-grad-start) 0%, var(--footer-grad-end) 100%); border-top: 1px solid var(--border); }
footer .c-container { display: flex; justify-content: center; gap: 80px; }
footer .c-footer-brand { max-width: 320px; }
footer .c-richtext { line-height: 1.7; color: var(--text-light); }
footer .c-richtext strong { color: var(--base); }
footer .c-richtext a { text-decoration: underline; color: var(--primary); }
footer .c-richtext a:hover { filter: brightness(85%); }
footer .linkgroup { display: flex; gap: 64px; flex-wrap: wrap; }
footer .links a { display: block; padding: 0.2em 0; color: var(--text-light); }
footer .links a:hover { color: var(--header-link-hover); }
@media screen and (max-width: 991px) {
	footer .c-container { flex-direction: column; gap: 24px; }
	footer .linkgroup { gap: 34px; }
}

/* Icons */
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 24px; display: inline-block; line-height: 1; text-transform: none; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; }

/* Avatar */
.c-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--text-muted); text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.c-avatar .material-symbols-outlined { font-size: 22px; }
.c-avatar:hover { background: var(--surface-muted); color: var(--header-link-hover); transform: translateY(-1px); }
.c-avatar.large { width: 56px; height: 56px; }
.c-avatar.large .material-symbols-outlined { font-size: 34px; }

/* Data rows */
.c-datarows { border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--surface); overflow: hidden; }
.c-datarows .head { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.c-datarows .head h2 { margin: 0; font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.c-datarows .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 16px; font-size: 0.87rem; border-bottom: 1px solid var(--border); transition: background-color 0.2s ease; }
.c-datarows .row.multiline { align-items: flex-start; }
.c-datarows .row:last-child { border-bottom: none; }
.c-datarows .row:hover { background: var(--surface-muted); }
.c-datarows .row .k { color: var(--text-light); font-family: var(--font-mono); font-size: 0.82rem; }
.c-datarows .row .v { text-align: right; }
.c-datarows .row .v.mono { font-family: var(--font-mono); font-size: 0.85rem; }
.c-datarows .row .v.soon { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.c-datarows .row.multiline .v { text-align: left; white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.8rem; }
.c-datarows .row.multiline .v summary { margin-top: 4px; cursor: pointer; color: var(--accent); font-family: var(--font-body); font-size: 0.78rem; white-space: normal; }
.c-datarows .row.multiline .v summary:hover { text-decoration: underline; }
.c-datarows .empty { padding: 12px 16px; margin: 0; }
.c-datarows .row input.c-input,
.c-datarows .row select.c-input { width: auto; min-width: 160px; }

/* Buttons */
.c-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.45em 0.9em 0.5em; border-radius: var(--radius-medium); font-weight: 600; border: 1px solid transparent; transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease; }
.c-btn.small { padding: 0.3em 0.7em 0.35em; font-size: 0.82rem; }
.c-btn.primary { color: var(--on-accent); background: var(--accent); box-shadow: 0 8px 20px var(--shadow); }
.c-btn.primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.c-btn.ghost { color: var(--base); border-color: var(--border); background: var(--surface); }
.c-btn.ghost:hover { background: var(--surface-muted); }
.c-btn.danger { color: var(--state-risk-text); border-color: var(--border); background: var(--surface); }
.c-btn.danger:hover { background: var(--state-risk-bg); border-color: var(--state-risk-text); }

/* Field */
.c-field { display: grid; gap: 6px; }
.c-field label { font-size: 0.85rem; font-weight: 600; color: var(--text-light); }

/* Input */
.c-input { width: 100%; padding: 0.6em 0.8em; border-radius: var(--radius-medium); border: 1px solid var(--border); background: var(--surface); color: var(--base); font: inherit; }

/* Toggle */
.c-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.87rem; }
.c-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.c-toggle .track { width: 36px; height: 20px; border-radius: var(--radius-full); background: var(--surface-muted); border: 1px solid var(--border); position: relative; flex-shrink: 0; transition: background-color 0.2s ease, border-color 0.2s ease; }
.c-toggle .knob { position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform 0.2s ease, background-color 0.2s ease; }
.c-toggle input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.c-toggle input:checked + .track .knob { transform: translateX(16px); background: var(--accent); }

/* Icon buttons */
.c-iconbtn { background: transparent; border: none; cursor: pointer; color: var(--text-light); transition: all 0.2s ease; border-radius: var(--radius-small); display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 6px 10px; }
.c-iconbtn .material-symbols-outlined { font-size: 20px; }
.c-iconbtn.add:hover { background: var(--surface-muted); color: var(--primary); }
.c-iconbtn.edit:hover { background: var(--surface-muted); color: var(--primary); }
.c-iconbtn.copy:hover { background: var(--surface-tint); color: var(--primary); }
.c-iconbtn.close:hover { background: var(--surface-muted); color: var(--text-dark); }
.c-iconbtn.delete:hover { background: var(--state-risk-bg); color: var(--state-risk-text); }

/* Code block */
.c-codeblock { position: relative; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--font-mono); overflow: hidden; }
.c-codeblock code { flex: 1; font-size: 0.85rem; color: var(--text-dark); word-break: break-all; white-space: pre-wrap; line-height: 1.4; }

/* Console */
.c-console { font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.7; font-variant-numeric: tabular-nums; overflow-x: auto; }
.c-console.boxed { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-medium); padding: 14px 16px; }
.c-console .line { display: flex; align-items: baseline; margin: 0 0 2px; color: var(--text-dark); white-space: nowrap; }
.c-console .line:last-of-type { margin-bottom: 0; }
.c-console span { min-width: calc(var(--fixlen) * 1ch); }
.c-console .textfollows { margin-right: 1ch; }
.c-console .textpreceding { margin-left: 1ch; }
.c-console .right { text-align: right; }
.c-console .gray { color: var(--text-light); }
.c-console .red { color: var(--state-risk-text); }
.c-console .yellow { color: var(--state-warn-text); }
.c-console .green { color: var(--state-ok-text); }

/* Tabs */
.c-tabs .tablist { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-full); background: var(--surface-muted); border: 1px solid var(--border); }
.c-tabs .tab { padding: 0.4em 0.9em; border: none; border-radius: var(--radius-full); background: transparent; color: var(--text-light); font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease; }
.c-tabs .tab:hover { color: var(--text-dark); }
.c-tabs .tab.active { background: var(--accent); color: var(--on-accent); }
.c-tabs .panels { margin-top: 16px; }
.c-tabs .panel { display: none; }
.c-tabs .panel.active { display: block; }

/* Tabs + carousel (combined) */
.c-tabcarousel .tablist { display: inline-flex; gap: 2px; margin-bottom: 20px; padding: 3px; border-radius: var(--radius-full); background: var(--surface-muted); border: 1px solid var(--border); }
.c-tabcarousel .tab { padding: 0.4em 0.9em; border: none; border-radius: var(--radius-full); background: transparent; color: var(--text-light); font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease; }
.c-tabcarousel .tab:hover { color: var(--text-dark); }
.c-tabcarousel .tab.active { background: var(--accent); color: var(--on-accent); }
.c-tabcarousel .track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.c-tabcarousel .track::-webkit-scrollbar { display: none; }
.c-tabcarousel .slide { flex: 0 0 100%; scroll-snap-align: start; min-width: 0; }
