/*
 * Rzec AB — reveal.js theme overrides
 * Loaded after the base reveal.js theme (black.css).
 */

/* ---------- Brand tokens ---------- */
:root {
	--rzec-green: #7cffa8;
	--rzec-bright: #e8fff0;
	--rzec-ink: #0c4022; /* dark green text on bright pills */
	--rzec-bg: #000000;
	--rzec-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

	/* Re-point the base theme's (blue) accents to brand green */
	--r-link-color: var(--rzec-green);
	--r-link-color-hover: var(--rzec-bright);
	--r-link-color-dark: #3fcf74;
	--r-selection-background-color: var(--rzec-green);
	--r-selection-color: var(--rzec-ink);
	--r-code-font: var(--rzec-mono);

	/* Typography: Space Grotesk (headings), Inter (body), JetBrains Mono (accents) */
	--r-main-font: 'Inter', 'Helvetica Neue', Arial, sans-serif;
	--r-heading-font: 'Space Grotesk', 'Inter', 'Helvetica Neue', Arial, sans-serif;
	--r-heading-font-weight: 600;
	--r-heading-text-transform: none;
	--r-heading-letter-spacing: -0.02em;
}

/* ---------- Animated CyberGrid background ---------- */
#bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	/* Dimmed on content slides, full strength on the title slide */
	opacity: 0.4;
	transition: opacity 1.2s ease;
}
.rzec-title #bg {
	opacity: 1;
}
.rzec-divider #bg {
	opacity: 0.7;
}

/* Let the background show through reveal's viewport and slide backgrounds */
html {
	background: var(--rzec-bg);
}
body,
.reveal-viewport {
	background: transparent !important;
}
.reveal {
	position: relative;
	z-index: 1;
}
.reveal .slide-background {
	background: transparent;
}

/* ---------- Typography ---------- */
.reveal {
	font-family: var(--r-main-font);
	font-weight: 400;
}
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
	font-family: var(--r-heading-font);
	font-weight: var(--r-heading-font-weight);
	text-transform: var(--r-heading-text-transform);
	letter-spacing: var(--r-heading-letter-spacing);
}
.reveal h3,
.reveal h4 {
	font-weight: 500;
}

/* Highlight pill — same look as the word pills in the background */
.reveal strong {
	background: var(--rzec-bright);
	color: var(--rzec-ink);
	/* Monospace, like the pills drawn by cybergrid.js */
	font-family: var(--rzec-mono);
	font-size: 0.88em;
	font-weight: 500;
	padding: 0.05em 0.4em;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

/* ---------- Main content slide ---------- */
/* Fill the whole slide instead of being vertically centred.
 * Layout (slide px):  kicker label on top → terminal frame below it, with
 * the slide heading (<h2>) placed inside the frame's title bar. */
.reveal .slides > section.rzec-main {
	--panel-top: 44px; /* where the frame starts (below the kicker) */
	--bar: 64px;       /* height of the frame's title bar */

	top: 0 !important;
	height: 100%;
	padding: 0;
	box-sizing: border-box;
	text-align: left;
}
/* Heading sits inside the terminal title bar (left), dots are on the right */
.reveal .rzec-main > h2 {
	position: absolute;
	z-index: 2;
	top: var(--panel-top);
	left: 0;
	right: 110px; /* keep clear of the dots */
	height: var(--bar);
	margin: 0;
	padding-left: 24px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	/* Same typeface as the terminal body, so the bar reads as one piece */
	font-family: var(--rzec-mono);
	font-size: 0.66em;
	font-weight: 600;
	letter-spacing: -0.01em;
	line-height: 1.2;
	color: var(--rzec-bright);
	white-space: nowrap;
}
/* "~/" prompt prefix in front of the heading */
.reveal .rzec-main > h2::before {
	content: '~/';
	margin-right: 0.35em;
	font-weight: 500;
	color: var(--rzec-green);
	opacity: 0.8;
}
/* Kicker above the frame: "// 02 — Label" (text set by JS in index.html) */
.reveal .rzec-main > h2::after {
	content: attr(data-kicker);
	position: absolute;
	left: 0;
	bottom: calc(100% + 12px);
	font-family: var(--rzec-mono);
	font-size: 0.6em; /* relative to the heading's 0.66em */
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	white-space: nowrap;
	color: var(--rzec-green);
}

/* HUD corner brackets — reusable via .rzec-brackets (used by the statement slide) */
.reveal .rzec-brackets {
	--bracket: 22px;  /* bracket arm length */
	--bracket-w: 2px; /* bracket thickness */
	--bracket-c: var(--rzec-green);
	background-image:
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c)),
		linear-gradient(var(--bracket-c), var(--bracket-c));
	background-repeat: no-repeat;
	background-origin: border-box;
	background-position:
		top left, top left,
		top right, top right,
		bottom left, bottom left,
		bottom right, bottom right;
	background-size:
		var(--bracket) var(--bracket-w), var(--bracket-w) var(--bracket),
		var(--bracket) var(--bracket-w), var(--bracket-w) var(--bracket),
		var(--bracket) var(--bracket-w), var(--bracket-w) var(--bracket),
		var(--bracket) var(--bracket-w), var(--bracket-w) var(--bracket);
}

/* ---------- Frame: terminal window ----------
 * Classic window chrome: title bar with the slide heading on the left and
 * three dots on the right, dark solid body, monospace text, prompt-style
 * bullets and a blinking cursor at the end.
 */
.reveal .rzec-panel {
	--bar: 64px; /* title bar height (matches section.rzec-main) */

	position: absolute;
	top: var(--panel-top, 44px);
	bottom: 44px; /* ends just above the 32px logo */
	left: 0;
	right: 0;
	box-sizing: border-box;
	overflow: hidden;
	padding: calc(var(--bar) + 1em) 1.5em 1.2em;
	font-family: var(--rzec-mono);
	font-size: 0.58em;
	line-height: 1.6;
	color: #d6f5e0;
	background: rgba(4, 9, 6, 0.86);
	border: 1px solid rgba(124, 255, 168, 0.18);
	border-radius: 8px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* Title bar: background strip with three dots on the right
 * (the heading itself is the <h2>, positioned on top of this bar) */
.reveal .rzec-panel::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: var(--bar);
	border-bottom: 1px solid rgba(124, 255, 168, 0.12);
	background:
		radial-gradient(circle, rgba(124, 255, 168, 0.16) 0 5px, transparent 6px) right 60px center / 16px 16px no-repeat,
		radial-gradient(circle, rgba(124, 255, 168, 0.32) 0 5px, transparent 6px) right 38px center / 16px 16px no-repeat,
		radial-gradient(circle, rgba(124, 255, 168, 0.55) 0 5px, transparent 6px) right 16px center / 16px 16px no-repeat,
		rgba(124, 255, 168, 0.05);
}

/* Text inside the terminal */
.reveal .rzec-panel h3 {
	font-family: var(--rzec-mono);
	font-weight: 500;
	letter-spacing: 0;
}
.reveal .rzec-panel h3::before {
	content: '# ';
	opacity: 0.6;
}
.reveal .rzec-panel ul {
	list-style: none;
	margin-left: 0;
	padding-left: 0;
}
.reveal .rzec-panel ul > li {
	position: relative;
	padding-left: 1.4em;
}
.reveal .rzec-panel ul > li::before {
	content: '›';
	position: absolute;
	left: 0.2em;
	color: var(--rzec-green);
	font-weight: 500;
}

/* Blinking block cursor after the last element */
.reveal .rzec-panel > :last-child::after,
.reveal .rzec-panel.rzec-cols > :last-child > :last-child::after {
	content: '';
	display: inline-block;
	width: 0.6em;
	height: 1.15em;
	margin-left: 0.25em;
	vertical-align: -0.2em;
	background: var(--rzec-green);
	animation: rzec-blink 1.1s steps(1) infinite;
}
.reveal .rzec-panel.rzec-cols > :last-child::after {
	content: none;
}

.reveal .present .rzec-panel,
.reveal .present.rzec-main > h2 {
	animation: rzec-fade-in 0.5s ease-out 0.1s both;
}
@keyframes rzec-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
	.reveal .present .rzec-panel,
	.reveal .present.rzec-main > h2,
	.reveal .rzec-panel > :last-child::after,
	.reveal .rzec-panel.rzec-cols > :last-child > :last-child::after {
		animation: none;
	}
}
.reveal .rzec-panel > :first-child {
	margin-top: 0;
}
.reveal .rzec-panel > :last-child {
	margin-bottom: 0;
}
.reveal .rzec-panel ul,
.reveal .rzec-panel ol {
	display: block;
}
.reveal .rzec-panel ol {
	margin-left: 1.6em;
}
.reveal .rzec-panel li::marker {
	color: var(--rzec-green);
}
.reveal .rzec-panel h3 {
	margin: 0 0 0.5em;
	font-size: 1.15em;
	color: var(--rzec-green);
}

/* Two-column frame: <div class="rzec-panel rzec-cols"><div>…</div><div>…</div></div> */
.reveal .rzec-panel.rzec-cols {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 2.4em;
}
.reveal .rzec-cols > div + div {
	padding-left: 1.2em;
	margin-left: -1.2em; /* centre the divider line in the gap */
	border-left: 1px solid rgba(124, 255, 168, 0.2);
}
.reveal .rzec-cols > div > :first-child {
	margin-top: 0;
}
.reveal .rzec-cols > div > :last-child {
	margin-bottom: 0;
}

/* ---------- Media frame (video / iframe) ----------
 * <div class="rzec-panel rzec-panel--media"><iframe …></iframe></div>
 * The iframe fills the frame edge to edge below the title bar. */
.reveal .rzec-panel--media {
	padding: var(--bar) 0 0;
	background: #000;
}
.reveal .rzec-panel--media > iframe,
.reveal .rzec-panel--media > video {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
	background: #000;
}

/* ---------- Code ----------
 * Fenced code in Markdown (```csharp) is highlighted by RevealHighlight.
 * Inside a frame it gets a darker well; a frame with ONLY a code block
 * becomes a full code frame (.rzec-panel--code, set by rzec.js).
 * Line numbers / step highlights:  ```csharp [6|8-9|11-12]
 */
.reveal .rzec-panel pre {
	width: 100%;
	margin: 1em 0;
	font-size: 0.9em;
	line-height: 1.55;
	box-shadow: none;
	background: rgba(0, 0, 0, 0.45);
	border: 1px solid rgba(124, 255, 168, 0.12);
	border-radius: 4px;
}
.reveal .rzec-panel pre code {
	max-height: none;
	padding: 0.9em 1.2em;
	font-family: var(--rzec-mono);
	background: transparent;
	tab-size: 4;
	/* Keep code lines intact; rzec.js shrinks the font so it fits instead */
	white-space: pre;
	word-wrap: normal;
	word-break: normal;
	overflow: hidden;
}
/* Code-only frame: the code fills the frame below the title bar */
.reveal .rzec-panel--code {
	padding: var(--bar) 0 0;
}
.reveal .rzec-panel--code > pre {
	height: 100%;
	margin: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
}
.reveal .rzec-panel--code > pre > code {
	height: 100%;
	box-sizing: border-box;
	padding: 1em 1.5em;
}
/* No blinking cursor after code */
.reveal .rzec-panel > pre:last-child::after {
	content: none;
}
/* Line numbers */
.reveal .hljs-ln-numbers {
	padding-left: 0.9em !important; /* room for the highlight bar */
	padding-right: 1.4em !important;
	color: rgba(124, 255, 168, 0.35);
	opacity: 1;
	user-select: none;
}
/* Step highlights: strongly dim the other lines, mark the active ones */
.reveal .hljs.has-highlights tr:not(.highlight-line) {
	opacity: 0.14;
	filter: grayscale(1);
}
.reveal .hljs.has-highlights tr {
	transition: opacity 0.3s ease, filter 0.3s ease, background-color 0.3s ease;
}
.reveal .hljs.has-highlights tr.highlight-line {
	background: rgba(124, 255, 168, 0.07);
}
.reveal .hljs.has-highlights tr.highlight-line .hljs-ln-numbers {
	color: var(--rzec-green);
	box-shadow: inset 3px 0 0 var(--rzec-green);
}
/* Inline `code` in text */
.reveal .rzec-panel :not(pre) > code,
.reveal li > code,
.reveal p > code {
	padding: 0.05em 0.35em;
	font-family: var(--rzec-mono);
	font-size: 0.92em;
	color: var(--rzec-green);
	background: rgba(124, 255, 168, 0.1);
	border-radius: 3px;
}

/* Syntax colours — green terminal palette (replaces monokai.css) */
.reveal .hljs {
	color: #d6f5e0;
	background: transparent;
}
.reveal .hljs-comment,
.reveal .hljs-quote {
	color: #5f8a6e;
	font-style: italic;
}
.reveal .hljs-keyword,
.reveal .hljs-selector-tag,
.reveal .hljs-built_in,
.reveal .hljs-literal,
.reveal .hljs-doctag {
	color: var(--rzec-green);
}
.reveal .hljs-type,
.reveal .hljs-title.class_,
.reveal .hljs-title.class_.inherited__,
.reveal .hljs-class .hljs-title {
	color: #9ee7ff;
}
.reveal .hljs-title,
.reveal .hljs-title.function_,
.reveal .hljs-section {
	color: var(--rzec-bright);
	font-weight: 600;
}
.reveal .hljs-string,
.reveal .hljs-regexp,
.reveal .hljs-char.escape_ {
	color: #f2d98a;
}
.reveal .hljs-number,
.reveal .hljs-symbol,
.reveal .hljs-bullet {
	color: #ffb27a;
}
.reveal .hljs-meta,
.reveal .hljs-meta .hljs-keyword,
.reveal .hljs-attr,
.reveal .hljs-attribute {
	color: #a3c9b0;
}
.reveal .hljs-variable,
.reveal .hljs-params,
.reveal .hljs-property,
.reveal .hljs-template-variable {
	color: #d6f5e0;
}
.reveal .hljs-addition {
	color: var(--rzec-green);
	background: rgba(124, 255, 168, 0.08);
}
.reveal .hljs-deletion {
	color: #ff8a8a;
	background: rgba(255, 80, 80, 0.08);
}
.reveal .hljs-emphasis {
	font-style: italic;
}
.reveal .hljs-strong {
	font-weight: 600;
}

/* ---------- Screenshot inside a frame ----------
 * <figure class="rzec-shot">
 *   <img src="screenshot.png" alt="…" />
 *   <figcaption>fig.1 — description</figcaption>
 * </figure>
 * Add class "rzec-shot--full" to let the image use the full frame width.
 */
.reveal .rzec-shot {
	margin: 1em 0;
	text-align: left;
}
.reveal .rzec-shot img {
	display: block;
	max-width: 100%;
	max-height: 320px; /* keep tall screenshots inside the frame */
	width: auto;
	height: auto;
	margin: 0;
	padding: 0;
	background: #fff;
	border: 1px solid rgba(124, 255, 168, 0.35);
	border-radius: 4px;
	box-shadow: 0 0 0 4px rgba(124, 255, 168, 0.06), 0 10px 30px rgba(0, 0, 0, 0.5);
}
/* Size presets — in Markdown, put this right after the image:
 *   ![alt](shot.png "caption") <!-- .element: class="w-50" -->
 * Any explicit width also lifts the 320px height cap. The presets work on
 * any image, also one that ends up inside a list item. */
.reveal img.w-25  { width: 25%;  height: auto; max-height: none; }
.reveal img.w-33  { width: 33%;  height: auto; max-height: none; }
.reveal img.w-50  { width: 50%;  height: auto; max-height: none; }
.reveal img.w-66  { width: 66%;  height: auto; max-height: none; }
.reveal img.w-75  { width: 75%;  height: auto; max-height: none; }
.reveal img.w-100 { width: 100%; height: auto; max-height: none; }
.reveal .rzec-shot img[style*='width'] { max-height: none; }
.reveal .rzec-shot--full img {
	width: 100%;
	max-height: none;
	object-fit: contain;
}
.reveal .rzec-shot figcaption {
	margin-top: 0.6em;
	font-size: 0.8em;
	letter-spacing: 0.04em;
	color: rgba(214, 245, 224, 0.55);
}
.reveal .rzec-shot figcaption::before {
	content: '↳ ';
	color: var(--rzec-green);
}

/* ---------- Section divider slide ---------- */
/* <section class="rzec-divider" data-state="rzec-divider">
 *   <span class="rzec-num"></span>  (auto-numbered 01, 02… if left empty)
 *   <h2>Section title</h2>
 *   <p>Optional one-liner</p>
 * </section> */
.reveal .rzec-divider {
	text-align: left;
}
/* Number and title use JetBrains Mono, like the title slide and content headings */
.reveal .rzec-divider .rzec-num {
	display: block;
	font-family: var(--rzec-mono);
	font-size: 4em;
	font-weight: 600;
	line-height: 1;
	letter-spacing: -0.04em;
	color: transparent;
	-webkit-text-stroke: 2px var(--rzec-green);
	filter: drop-shadow(0 0 14px rgba(124, 255, 168, 0.35));
}
.reveal .rzec-divider h2 {
	margin: 0.25em 0 0.2em;
	font-family: var(--rzec-mono);
	font-size: 1.3em;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: #fff;
	text-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
}
.reveal .rzec-divider h2::after {
	content: '';
	display: block;
	width: 80px;
	height: 3px;
	margin-top: 0.3em;
	background: var(--rzec-green);
	box-shadow: 0 0 8px rgba(124, 255, 168, 0.6);
}
.reveal .rzec-divider p {
	margin: 0.6em 0 0;
	font-family: var(--rzec-mono);
	font-size: 0.55em;
	letter-spacing: 0.05em;
	color: var(--rzec-green);
}

/* ---------- Big statement slide ---------- */
/* <section class="rzec-statement">
 *   <blockquote class="rzec-brackets">One line with a <strong>highlight</strong>.</blockquote>
 *   <p class="rzec-source">— Source</p>
 * </section> */
.reveal .rzec-statement blockquote {
	width: auto;
	max-width: 85%;
	margin: 0 auto;
	padding: 0.9em 1.2em;
	font-family: var(--r-heading-font);
	font-size: 1.35em;
	font-weight: 500;
	font-style: normal;
	line-height: 1.3;
	letter-spacing: -0.01em;
	text-align: center;
	background-color: rgba(0, 0, 0, 0.55);
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}
.reveal .rzec-statement blockquote::before,
.reveal .rzec-statement blockquote::after {
	content: none;
}
.reveal .rzec-statement .rzec-source {
	margin-top: 0.8em;
	font-family: var(--rzec-mono);
	font-size: 0.5em;
	letter-spacing: 0.08em;
	color: var(--rzec-green);
}

/* ---------- Title slide ---------- */
/* Same typeface as the content-slide headings and subtitle (JetBrains Mono);
 * its squared, rounded letterforms also echo the logo's wordmark. */
.reveal .rzec-title h2 {
	margin: 0 0 0.35em;
	font-family: var(--rzec-mono);
	font-size: 1.2em;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: #fff;
	text-shadow: 0 0 18px rgba(0, 0, 0, 0.9);
}
/* Monospace subtitle with a blinking terminal cursor */
.reveal .rzec-title .rzec-subtitle {
	margin: 0;
	font-family: var(--rzec-mono);
	font-size: 0.55em;
	letter-spacing: 0.06em;
	color: var(--rzec-green);
}
.reveal .rzec-title .rzec-subtitle::after {
	content: '';
	display: inline-block;
	width: 0.6em;
	height: 1.1em;
	margin-left: 0.3em;
	vertical-align: -0.2em;
	background: var(--rzec-green);
	animation: rzec-blink 1.1s steps(1) infinite;
}
@keyframes rzec-blink {
	50% { opacity: 0; }
}

/* One-off scan line sweeping down the screen when the title slide appears */
.rzec-title .reveal::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 2px;
	z-index: 30;
	pointer-events: none;
	background: linear-gradient(90deg, transparent, var(--rzec-bright) 20%, var(--rzec-bright) 80%, transparent);
	box-shadow: 0 0 18px 4px rgba(124, 255, 168, 0.55);
	opacity: 0;
	animation: rzec-scan 1.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s 1 both;
}
@keyframes rzec-scan {
	0%   { top: 0;    opacity: 0; }
	10%  {            opacity: 1; }
	85%  {            opacity: 0.8; }
	100% { top: 100%; opacity: 0; }
}

/* ---------- Logo ---------- */
/* Large logo on the title slide */
.reveal .rzec-title .rzec-logo {
	display: block;
	width: 55%;
	max-width: 640px;
	height: auto;
	margin: 0 auto 0.6em;
	border: 0;
	box-shadow: none;
	background: none;
	/* Soft green glow, slowly breathing */
	filter: drop-shadow(0 0 18px rgba(124, 255, 168, 0.45));
	animation: rzec-glow 4s ease-in-out infinite;
}
@keyframes rzec-glow {
	50% { filter: drop-shadow(0 0 28px rgba(124, 255, 168, 0.7)); }
}
@media (prefers-reduced-motion: reduce) {
	.reveal .rzec-title .rzec-logo,
	.reveal .rzec-title .rzec-subtitle::after,
	.rzec-title .reveal::before {
		animation: none;
	}
}

/* Small logo in the bottom-right corner of every other slide.
 * Drawn on .slides (the scaled slide box), so it scales with the content
 * and stays in the same place relative to it at any window size. */
.reveal .slides::after {
	content: '';
	position: absolute;
	right: 0;
	bottom: 0;
	width: 134px; /* logo is 1051x251 → ~4.19:1 */
	height: 32px;
	background: url(rzec2025.png) no-repeat right bottom / contain;
	opacity: 0.9;
	pointer-events: none;
	z-index: 20;
	transition: opacity 0.4s ease;
}
.rzec-title .reveal .slides::after {
	opacity: 0;
}

/* ---------- Reveal chrome: progress bar, slide number, arrows ---------- */
.reveal .progress {
	top: 0;
	bottom: auto;
	height: 3px;
	color: var(--rzec-green);
	background: rgba(124, 255, 168, 0.08);
}
.reveal .progress span {
	box-shadow: 0 0 10px var(--rzec-green);
}
.reveal .controls {
	color: var(--rzec-green);
}
.reveal .slide-number {
	left: 24px;
	right: auto;
	bottom: 20px;
	background: transparent;
	color: var(--rzec-green);
	font-family: var(--rzec-mono);
	font-size: 13px;
	letter-spacing: 0.1em;
	opacity: 0.8;
	transition: opacity 0.4s ease;
}
.reveal .slide-number a {
	color: inherit;
}
.rzec-title .reveal .slide-number {
	opacity: 0;
}
