/**
 * Portfolio Grid — v2 Architecture
 *
 * All nodes are 100vw × 100vh.
 * The "card" appearance is a clip-path mask.
 * Mask fades when node is focused.
 */

:root {
	/* Typography */
	--font-display: 'Roboto Slab', serif;
	--font-body: 'Roboto', sans-serif;
	--font-mono: 'Roboto Mono', monospace;

	/* Colors — Light mode (default) */
	--color-bg: #EFEFEF;
	--color-node-bg: #FFFFFF;
	--color-border: #D4D4D4;
	--color-text: #1a1a1a;
	--color-text-dim: #666666;
	--color-title: #5E6A75;
	--color-accent: #0875E1;
	--color-panel: rgba(255, 255, 255, 0.9);

	/* Row colors for minmap (light mode) — sampled from logos */
	--color-row-title: transparent;
	--color-row-beta: rgba(124, 58, 237, 0.15);    /* BETA purple #7C3AED */
	--color-row-sf: rgba(0, 161, 224, 0.15);       /* Salesforce blue #00A1E0 */
	--color-row-wd: rgba(243, 139, 0, 0.15);       /* Workday orange #F38B00 */
	--color-row-ge: rgba(59, 115, 185, 0.15);      /* GE blue #3B73B9 */
	--color-row-archive: rgba(100, 100, 100, 0.08);
	--color-row-closing: transparent;

	/* Mask inset (creates the "card" appearance) */
	--mask-x: 6vw;
	--mask-y: 10vh;

	/* Timing — Precision easing (smooth decel, no overshoot) */
	--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
	--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
	--transition-pan: 500ms var(--ease-out-expo);
	--transition-reveal: 4s ease-in-out;
	--transition-mask-return: 300ms var(--ease-out-quart);
}

/* Dark mode — System preference */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--color-bg: #212121;
		--color-node-bg: #2a2a2a;
		--color-border: #404040;
		--color-text: #e3e3e3;
		--color-text-dim: #919191;
		--color-title: #FFFFFF;
		--color-accent: #4A9FE8;
		--color-panel: rgba(42, 42, 42, 0.9);

		/* Row colors for minmap (dark mode) — sampled from logos */
		--color-row-beta: rgba(124, 58, 237, 0.25);    /* BETA purple #7C3AED */
		--color-row-sf: rgba(0, 161, 224, 0.25);       /* Salesforce blue #00A1E0 */
		--color-row-wd: rgba(243, 139, 0, 0.20);       /* Workday orange #F38B00 */
		--color-row-ge: rgba(59, 115, 185, 0.25);      /* GE blue #3B73B9 */
		--color-row-archive: rgba(150, 150, 150, 0.10);
	}
}

/* Dark mode — Manual override */
[data-theme="dark"] {
	--color-bg: #212121;
	--color-node-bg: #2a2a2a;
	--color-border: #404040;
	--color-text: #e3e3e3;
	--color-text-dim: #919191;
	--color-title: #FFFFFF;
	--color-accent: #4A9FE8;
	--color-panel: rgba(42, 42, 42, 0.9);

	/* Row colors for minmap (dark mode) — sampled from logos */
	--color-row-beta: rgba(124, 58, 237, 0.25);    /* BETA purple #7C3AED */
	--color-row-sf: rgba(0, 161, 224, 0.25);       /* Salesforce blue #00A1E0 */
	--color-row-wd: rgba(243, 139, 0, 0.20);       /* Workday orange #F38B00 */
	--color-row-ge: rgba(59, 115, 185, 0.25);      /* GE blue #3B73B9 */
	--color-row-archive: rgba(150, 150, 150, 0.10);
}

/* Light mode — Manual override */
[data-theme="light"] {
	--color-bg: #EFEFEF;
	--color-node-bg: #FFFFFF;
	--color-border: #D4D4D4;
	--color-text: #1a1a1a;
	--color-text-dim: #666666;
	--color-title: #5E6A75;
	--color-accent: #0875E1;
	--color-panel: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	font-family: var(--font-body);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Viewport & Grid
   ========================================================================== */

.viewport {
	position: fixed;
	inset: 0;
	overflow: hidden;
}

.grid {
	position: absolute;
	top: 0;
	left: 0;
	will-change: transform;
	transition: transform var(--transition-pan);
}

/* ==========================================================================
   Node
   ========================================================================== */

.node {
	position: absolute;
	width: 100vw;
	height: 100vh;
	background: var(--color-node-bg);
	outline: none;
	contain: layout style paint;
	will-change: clip-path;

	/* Default: masked to show "card" appearance */
	clip-path: inset(var(--mask-y) var(--mask-x) var(--mask-y) var(--mask-x) round 16px);
	transition: clip-path var(--transition-mask-return);
}

/* Focused state: prepare for reveal */
.node:focus,
.node.is-focused {
	z-index: 1;
}

/* Revealed state: full bleed */
.node.is-revealed {
	clip-path: inset(0 0 0 0 round 0);
	transition: clip-path var(--transition-reveal);
}

/* Scrollable nodes: consistent overflow in both modes to prevent jump */
.node[data-scrollable] {
	overflow-y: auto;
	overflow-x: hidden;
	scrollbar-gutter: stable;
}

/* Adjacent nodes (not focused, not revealed) get slight dim */
.node.is-adjacent {
	opacity: 0.95;
}

/* Distant nodes */
.node.is-distant {
	opacity: 0.7;
}

/* ==========================================================================
   Node Content — Base
   ========================================================================== */

.node__content {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
	padding: 48px;
	text-align: center;
}

/* ==========================================================================
   Template Typography (8px base unit)
   ========================================================================== */

.t-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 32px;
	line-height: 40px;
	font-weight: 700;
	color: var(--color-title);
	letter-spacing: 0.01em;
}

.t-title--display {
	font-size: 48px;
	line-height: 56px;
}

.t-subtitle {
	margin: 0;
	font-family: var(--font-body);
	font-size: 24px;
	line-height: 32px;
	font-weight: 400;
	color: var(--color-title);
}

.t-meta {
	margin: 0;
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 24px;
	font-weight: 400;
	color: var(--color-text-dim);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.t-body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 24px;
	font-weight: 400;
	color: var(--color-text);
}

.t-body--large {
	font-size: 18px;
	line-height: 28px;
}

.t-statement {
	margin: 0;
	font-family: var(--font-display);
	font-size: 32px;
	line-height: 40px;
	font-weight: 300;
	color: var(--color-text);
}

.t-caption {
	margin: 0;
	font-family: var(--font-body);
	font-size: 14px;
	line-height: 24px;
	font-weight: 400;
	color: var(--color-text-dim);
}

.t-label {
	margin: 0;
	font-family: var(--font-body);
	font-size: 12px;
	line-height: 16px;
	font-weight: 700;
	color: var(--color-text-dim);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.t-code {
	font-family: var(--font-mono);
	font-size: 14px;
	line-height: 24px;
}

.t-term {
	font-family: var(--font-mono);
	font-weight: 700;
	color: var(--color-text-dim);
}

/* ==========================================================================
   Template: Entry (Project Hero)
   - Large title, company/role, tagline
   - Optional hero image (right side)
   ========================================================================== */

.template-entry {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr;
	gap: 64px;
	align-items: center;
	width: 100%;
	height: 100%;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 48px);
	text-align: left;
}

.template-entry__text {
	display: flex;
	flex-direction: column;
	gap: 24px;
	max-width: 560px;
}

.template-entry__meta {
	display: flex;
	gap: 16px;
	align-items: center;
}

.template-entry__meta .t-meta:not(:last-child)::after {
	content: '·';
	margin-left: 16px;
	color: var(--color-text-dim);
}

.template-entry__logo {
	display: flex;
	justify-content: center;
	margin: 24px 0;
}

.template-entry__logo img {
	max-height: 128px;
	width: auto;
}

/* Dark mode logo adjustments for contrast */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .template-entry__logo img[src*="BETA"] {
		filter: brightness(0) invert(1);
	}
	:root:not([data-theme="light"]) .template-entry__logo img[src*="ge_logo"] {
		filter: brightness(0) invert(1);
	}
}

[data-theme="dark"] .template-entry__logo img[src*="BETA"] {
	filter: brightness(0) invert(1);
}

[data-theme="dark"] .template-entry__logo img[src*="ge_logo"] {
	filter: brightness(0) invert(1);
}

.template-entry__title {
	margin-bottom: 8px;
}

.template-entry__tagline {
	max-width: 480px;
	color: #5E6A75;
}

.template-entry__tagline a {
	color: var(--color-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 0.2s ease;
}

.template-entry__tagline a::after {
	content: ' ⧉';
	text-decoration: none;
}

.template-entry__tagline a:hover {
	color: var(--color-text-bright);
}

.template-entry__visual {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100%;
	overflow: hidden;
	border-radius: 8px;
}

.template-entry__visual img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 8px;
}

/* Entry without image: center text */
.template-entry--text-only {
	grid-template-columns: 1fr;
	justify-items: center;
	text-align: center;
}

.template-entry--text-only .template-entry__text {
	align-items: center;
}

.template-entry--text-only .template-entry__tagline {
	text-align: center;
}

/* ==========================================================================
   Template: Detail (Narrative + Visual)
   - Section title, body text, supporting image
   ========================================================================== */

.template-detail {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr;
	gap: 64px;
	align-items: center;
	width: 100%;
	height: 100%;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 48px);
	text-align: left;
}

.template-detail__text {
	display: flex;
	flex-direction: column;
	gap: 24px;
	max-width: 560px;
}

.template-detail__title {
	margin-bottom: 8px;
}

.template-detail__body {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.template-detail__visual {
	display: flex;
	flex-direction: column;
	gap: 12px;
	height: 100%;
	justify-content: center;
}

.template-detail__image {
	width: 100%;
	border-radius: 8px;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Detail with image on left */
.template-detail--image-left {
	grid-template-columns: 1fr 1fr;
}

.template-detail--image-left .template-detail__visual {
	order: -1;
}

/* Detail text-only (no image) */
.template-detail--text-only {
	display: flex;
	justify-content: center;
	align-items: center;
}

.template-detail--text-only .template-detail__text {
	align-items: center;
	text-align: center;
	max-width: 640px;
}

/* ==========================================================================
   Template: Artifact (Full-Bleed Visual)
   - Image covers most of viewport
   - Minimal text overlay
   ========================================================================== */

.template-artifact {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 24px);
}

.template-artifact__image {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 8px 48px rgba(0, 0, 0, 0.12);
}

.template-artifact__overlay {
	position: absolute;
	bottom: 64px;
	left: 64px;
	right: 64px;
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 24px;
}

.template-artifact__info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
}

.template-artifact__title,
.template-artifact__subtitle,
.template-artifact__link {
	background: var(--color-panel);
	padding: 8px 16px;
	border-radius: 6px;
	backdrop-filter: blur(8px);
}

.template-artifact__title {
	padding: 12px 16px;
}

.template-artifact__link a {
	color: var(--color-accent);
	text-decoration: none;
}

.template-artifact__link a:hover {
	text-decoration: underline;
}

.template-artifact__caption {
	background: var(--color-panel);
	padding: 8px 12px;
	border-radius: 6px;
	backdrop-filter: blur(8px);
	max-width: 400px;
	text-align: right;
}

/* ==========================================================================
   Template: Index (Multi-Column Taxonomy)
   - Title + grid of items/categories
   ========================================================================== */

.template-index {
	display: flex;
	flex-direction: column;
	gap: 48px;
	width: 100%;
	min-height: 100%;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 48px);
}

.template-index__header {
	text-align: center;
}

.template-index__description {
	max-width: 640px;
	margin: 16px auto 0;
}

.template-index__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 24px;
	flex: 1;
	align-content: start;
}

.template-index__category {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.template-index__category-title {
	padding-bottom: 8px;
	border-bottom: 1px solid var(--color-border);
}

.template-index__items {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.template-index__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 0;
}

.template-index__item-icon {
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-bg);
	border-radius: 4px;
	flex-shrink: 0;
}

/* ==========================================================================
   Template: Text-Only (Prose)
   - Flexible headers, body paragraphs
   - Centered, max-width constrained
   ========================================================================== */

.template-text {
	display: flex;
	flex-direction: column;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 48px);
}

.template-text__content {
	max-width: 720px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.template-text__header {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}

.template-text__body {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.template-text__link {
	margin-top: 24px;
}

.template-text__link a {
	color: var(--color-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	font-size: 14px;
	font-family: var(--font-mono);
	cursor: pointer;
	transition: color 0.2s ease;
}

.template-text__link a:hover {
	color: var(--color-text-bright);
}

.template-text__link .arrow-icon {
	display: inline-block;
	margin-left: 4px;
	text-decoration: none;
}

.template-text__blockquote {
	padding-left: 24px;
	border-left: 3px solid var(--color-accent);
	font-style: italic;
}

.template-text--left {
	text-align: left;
}

.template-text--left .template-text__content {
	margin-left: 0;
}

.template-text--center {
	text-align: center;
}

/* ==========================================================================
   Template: Placeholder (Development)
   - Simple centered title for unimplemented nodes
   ========================================================================== */

.template-placeholder {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
	padding: 48px;
	text-align: center;
}

.template-placeholder__title {
	margin: 0 0 8px 0;
	font-family: var(--font-display);
	font-size: clamp(24px, 5vw, 48px);
	font-weight: 700;
	color: var(--color-title);
	letter-spacing: 0.01em;
}

.template-placeholder__subtitle {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(14px, 2vw, 18px);
	font-weight: 700;
	color: var(--color-title);
}

/* Legacy support during transition */
.node__title {
	margin: 0 0 8px 0;
	font-family: var(--font-display);
	font-size: clamp(24px, 5vw, 48px);
	font-weight: 700;
	color: var(--color-title);
	letter-spacing: 0.01em;
}

.node__subtitle {
	margin: 0;
	font-family: var(--font-display);
	font-size: clamp(14px, 2vw, 18px);
	font-weight: 700;
	color: var(--color-title);
}

/* ==========================================================================
   Template: Video (Dynamic)
   - Title/link anchored at top, video flows to bottom and can crop
   ========================================================================== */

.template-video {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.template-video__header {
	text-align: center;
	padding: calc(var(--mask-y) + 48px) calc(var(--mask-x) + 32px) 24px;
	flex-shrink: 0;
}

.template-video__link {
	display: inline-block;
	margin-top: 12px;
	color: var(--color-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	font-size: 14px;
	font-family: var(--font-mono);
	transition: color 0.2s ease;
	cursor: pointer;
}

.template-video__link::after {
	content: ' ⧉';
	text-decoration: none;
}

.template-video__link:hover {
	color: var(--color-text-bright);
}

.template-video__container {
	flex: 1;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	min-height: 0;
	padding: 0 calc(var(--mask-x) + 32px);
	overflow: hidden;
}

.template-video__player,
.template-video__image {
	max-width: 100%;
	max-height: 100%;
	border-radius: 8px 8px 0 0;
	box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.12);
}

.template-video__caption {
	position: absolute;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-panel);
	padding: 12px 20px;
	border-radius: 6px;
	backdrop-filter: blur(8px);
	max-width: 600px;
	text-align: center;
}

/* ==========================================================================
   Template: Cropped (Dynamic)
   - Large image with pan/zoom and animated highlight
   ========================================================================== */

.template-cropped {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.template-cropped__viewport {
	position: absolute;
	inset: 64px;
	overflow: hidden;
	border-radius: 8px;
	background: var(--color-bg);
}

.template-cropped__image {
	position: absolute;
	top: 0;
	left: 0;
	transform-origin: 0 0;
	transition: transform 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.template-cropped__highlight {
	position: absolute;
	border: 3px solid var(--color-accent);
	border-radius: 8px;
	box-shadow: 0 0 0 4px rgba(8, 117, 225, 0.2);
	pointer-events: none;
	transition: all 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
	opacity: 0;
}

.template-cropped__highlight.is-visible {
	opacity: 1;
}

.template-cropped__label {
	position: absolute;
	bottom: 80px;
	left: 50%;
	transform: translateX(-50%);
	background: var(--color-panel);
	padding: 12px 20px;
	border-radius: 6px;
	backdrop-filter: blur(8px);
	text-align: center;
	opacity: 0;
	transition: opacity 300ms;
}

.template-cropped__label.is-visible {
	opacity: 1;
}

.template-cropped__controls {
	position: absolute;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
}

.template-cropped__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--color-border);
	border: none;
	padding: 0;
	cursor: pointer;
	transition: background 150ms, transform 150ms;
}

.template-cropped__dot:hover {
	transform: scale(1.25);
}

.template-cropped__dot.is-active {
	background: var(--color-accent);
}

/* ==========================================================================
   Template: Intro (Interactive Logo)
   ========================================================================== */

.template-intro {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 100%;
	height: 100%;
	padding: 48px;
}

/* Interactive logo (3 overlapping layers) */
.template-intro__logo {
	position: relative;
	width: 256px;
	height: 256px;
	cursor: pointer;
}

.template-intro__logo .logo-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0.4;
	transition: opacity 0.3s ease, transform 0.05s linear, filter 0.3s ease;
	pointer-events: none;
	/* Dark mode: white SVGs show as-is */
}

/* Light mode: invert white SVGs to black */
:root:not([data-theme="dark"]) .template-intro__logo .logo-layer {
	filter: invert(1);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .template-intro__logo .logo-layer {
		filter: none;
	}
}

[data-theme="light"] .template-intro__logo .logo-layer {
	filter: invert(1);
}

[data-theme="dark"] .template-intro__logo .logo-layer {
	filter: none;
}

.template-intro__logo:hover .logo-layer {
	opacity: 0.8;
}

.template-intro__logo .logo-layer.flash {
	opacity: 1 !important;
	filter: brightness(1.5);
}

/* Preserve invert on flash in light mode */
:root:not([data-theme="dark"]) .template-intro__logo .logo-layer.flash {
	filter: invert(1) brightness(1.5);
}

[data-theme="light"] .template-intro__logo .logo-layer.flash {
	filter: invert(1) brightness(1.5);
}

/* Smooth return when mouse leaves */
.template-intro__logo.is-leaving .logo-layer {
	transition: transform 500ms var(--ease-out-expo), opacity 0.3s ease;
}

/* ==========================================================================
   Template: Contact (Resume/CTA)
   - Contact info, resume download, links
   ========================================================================== */

.template-contact {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	width: 100%;
	height: 100%;
	padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 48px);
	text-align: left;
}

.template-contact__content {
	max-width: 600px;
}

.template-contact__title {
	margin: 0 0 16px 0;
}

.template-contact__statement {
	margin: 0;
	text-align: left;
}

.template-contact__statement a {
	color: var(--color-accent);
	text-decoration: none;
}

.template-contact__statement a:hover {
	text-decoration: underline;
}

.template-contact__note {
	margin: 48px 0;
	color: var(--color-text-dim);
	text-align: left;
}

.template-contact__icons {
	display: flex;
	gap: 48px;
}

.template-contact__icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	color: var(--color-text);
	text-decoration: none;
	transition: color 0.15s ease;
}

.template-contact__icon:hover {
	color: var(--color-accent);
}

.template-contact__icon svg {
	width: 32px;
	height: 32px;
}

.template-contact__icon .t-label {
	color: inherit;
	text-align: center;
}

/* Legacy link styles (keeping for compatibility) */
.template-contact__body {
	margin: 0 0 48px 0;
}

.template-contact__links {
	display: flex;
	gap: 16px;
	justify-content: center;
	flex-wrap: wrap;
}

.template-contact__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	background: var(--color-accent);
	color: #fff;
	text-decoration: none;
	border-radius: 6px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 700;
	transition: background 150ms, transform 150ms;
}

.template-contact__link:hover {
	background: #0668c7;
	transform: translateY(-2px);
}

.template-contact__link--secondary {
	background: transparent;
	color: var(--color-text);
	border: 1px solid var(--color-border);
}

.template-contact__link--secondary:hover {
	background: var(--color-bg);
	border-color: var(--color-text-dim);
}

.template-contact__email {
	margin-top: 32px;
	font-family: var(--font-mono);
	font-size: 14px;
	color: var(--color-text-dim);
}

.template-contact__email a {
	color: var(--color-accent);
	text-decoration: none;
}

.template-contact__email a:hover {
	text-decoration: underline;
}

/* ==========================================================================
   Template: Sections (Multi-section scrollable content)
   - Multiple content sections with different layouts
   - Supports: text, lists, quotes, comparison slider, image galleries
   ========================================================================== */

.template-sections {
	width: 100%;
	min-height: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: calc(var(--mask-y) + 48px) calc(var(--mask-x) + 48px) calc(var(--mask-y) + 24px);
	display: flex;
	flex-direction: column;
}

.template-sections__header {
	margin-bottom: 32px;
	text-align: left;
	flex-shrink: 0;
}

.template-sections__content {
	display: flex;
	flex-direction: column;
	gap: 48px;
	flex: 1;
	/* No overflow: hidden — let clip-path handle cropping */
}

.template-sections__section {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Visual sections use side-by-side grid in both modes */
.template-sections__section--visual-left,
.template-sections__section--visual-right {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto 1fr;
	gap: 24px 48px;
	align-items: start;
}

/* Subtitle spans both columns in visual layouts */
.template-sections__section--visual-left > .template-sections__subtitle,
.template-sections__section--visual-right > .template-sections__subtitle {
	grid-column: 1 / -1;
	grid-row: 1;
	margin-bottom: 8px;
}

/* Explicit column placement for visual-left (visual on left, text on right) */
.template-sections__section--visual-left > .template-sections__visual {
	grid-column: 1;
	grid-row: 2;
}

.template-sections__section--visual-left > .template-sections__text {
	grid-column: 2;
	grid-row: 2;
}

/* Explicit column placement for visual-right (text on left, visual on right) */
.template-sections__section--visual-right > .template-sections__text {
	grid-column: 1;
	grid-row: 2;
}

.template-sections__section--visual-right > .template-sections__visual {
	grid-column: 2;
	grid-row: 2;
}

/* Visual container — stay within grid cell */
.template-sections__visual {
	min-height: 0;
	min-width: 0;
	max-width: 100%;
}

.template-sections__text {
	display: flex;
	flex-direction: column;
	gap: 16px;
	flex-shrink: 0;
}

.template-sections__subtitle {
	margin: 0 0 8px 0;
	font-family: var(--font-display);
	font-weight: 700;
	color: var(--color-text);
}

.template-sections__list {
	margin: 0;
	padding-left: 24px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.template-sections__list > li {
	padding-left: 8px;
}

.template-sections__sublist {
	margin: 12px 0 0 0;
	padding-left: 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	list-style-type: circle;
}

/* Quote layout: two-column when quote present */
.template-sections__text:has(.template-sections__quote) {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0 48px;
	align-items: start;
}

.template-sections__text:has(.template-sections__quote) .template-sections__subtitle {
	grid-column: 1 / -1;
}

.template-sections__quote {
	grid-column: 2;
	grid-row: 2;
	margin: 0;
	padding: 0;
	font-family: var(--font-display);
	font-weight: 300;
	font-size: 28px;
	line-height: 1.3;
	color: var(--color-text-dim);
	max-width: 240px;
}

.template-sections__quote p {
	margin: 0;
}

/* Columns layout */
.template-sections__section--columns .template-sections__subtitle {
	margin-bottom: 24px;
}

.template-sections__columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 48px;
}

.template-sections__column {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.template-sections__column .template-sections__list {
	margin: 8px 0 0 0;
}

.template-sections__column-image {
	margin: 16px 0 0 0;
}

.template-sections__column-image img {
	width: 100%;
	height: auto;
	border-radius: 4px;
	border: 1px solid var(--color-border);
}

.template-sections__column-image figcaption {
	margin-top: 8px;
}

/* Thumbnails grid */
.template-sections__thumbnails {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	margin-top: 16px;
}

.template-sections__thumbnail {
	aspect-ratio: 1;
	border: 1px solid var(--color-border);
	border-radius: 4px;
	background: var(--color-surface);
	overflow: hidden;
}

.template-sections__thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top left;
}

/* Lightbox */
.lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.9);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.is-active {
	opacity: 1;
	visibility: visible;
}

.lightbox__content {
	position: relative;
	max-width: 90vw;
	max-height: 90vh;
}

.lightbox__image {
	max-width: 100%;
	max-height: 85vh;
	border-radius: 4px;
}

.lightbox__caption {
	margin-top: 16px;
	text-align: center;
	color: var(--color-text-mid);
	font-size: 14px;
}

.lightbox__close {
	position: absolute;
	top: -40px;
	right: 0;
	padding: 8px;
	background: none;
	border: none;
	color: var(--color-text-mid);
	font-size: 24px;
	cursor: pointer;
	transition: color 0.15s ease;
}

.lightbox__close:hover {
	color: var(--color-text-bright);
}

/* Comparison Slider */
.template-sections__compare {
	position: relative;
}

.template-sections__compare-container {
	position: relative;
	border-radius: 8px;
	border: 1px solid var(--color-border);
	cursor: ew-resize;
	user-select: none;
	overflow: hidden;
}

.template-sections__compare-hint {
	margin-top: 8px;
	font-family: var(--font-mono);
	font-size: 12px;
	color: var(--color-text-dim);
	text-align: center;
}

/* Before image — in flow, sets container size */
.template-sections__compare-before {
	display: block;
	width: 100%;
	height: auto;
}

/* After wrapper — absolutely positioned overlay */
.template-sections__compare-after {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* After image inside wrapper — fill the wrapper */
.template-sections__compare-after img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: fill;
}

.template-sections__compare-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 4px;
	transform: translateX(-50%);
	cursor: ew-resize;
	z-index: 150;
}

.template-sections__compare-handle-line {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	background: #fff;
	transform: translateX(-50%);
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.template-sections__compare-handle-grip {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
}

/* Left chevron */
.template-sections__compare-handle-grip::before {
	content: '';
	width: 8px;
	height: 8px;
	border-left: 2px solid var(--color-text-dim);
	border-bottom: 2px solid var(--color-text-dim);
	transform: rotate(45deg);
	margin-left: 4px;
}

/* Right chevron */
.template-sections__compare-handle-grip::after {
	content: '';
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--color-text-dim);
	border-top: 2px solid var(--color-text-dim);
	transform: rotate(45deg);
	margin-right: 4px;
}

.template-sections__compare .t-caption {
	margin-top: 12px;
	text-align: center;
}

/* Images Gallery */
.template-sections__images {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.template-sections__figure {
	margin: 0;
}

.template-sections__figure img {
	width: 100%;
	height: auto;
	object-fit: contain;
	object-position: top left;
	border-radius: 8px;
	border: 1px solid var(--color-border);
}

.template-sections__figure figcaption {
	margin-top: 8px;
	text-align: center;
}

/* Images use consistent sizing in both card and revealed modes */

/* Links in sections content */
.template-sections a {
	color: var(--color-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 0.2s ease;
}

.template-sections a:hover {
	color: var(--color-text-bright);
}

/* ==========================================================================
   Navigation Panel (consolidated lower-left controls)
   ========================================================================== */

.nav-panel {
	position: fixed;
	bottom: 24px;
	left: 24px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 100;
	/* Pass through clicks to content behind */
	pointer-events: none;
}

/* Only visible children capture clicks */
.nav-panel > * {
	pointer-events: auto;
}

/* Hidden minmap shouldn't capture clicks */
.nav-panel .minmap.is-hidden {
	pointer-events: none;
}

/* Back button only captures when visible */
.nav-panel .back-btn:not(.is-visible) {
	pointer-events: none;
}

/* ==========================================================================
   Minmap
   ========================================================================== */

.minmap {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	/* Width set dynamically by JS based on grid size */
	padding: 16px;
	background: var(--color-panel);
	border: 1px solid var(--color-border);
	border-radius: 8px;
	backdrop-filter: blur(8px);
	opacity: 0.7;
	/* Fast appear */
	transition:
		opacity 200ms ease-out,
		transform 200ms ease-out;
}

.minmap:hover {
	opacity: 1;
}

/* Hide in immersive mode — slow disappear */
.minmap.is-hidden {
	transform: translateY(80px);
	opacity: 0;
	pointer-events: none;
	transition:
		opacity 800ms ease-in-out,
		transform 800ms ease-in-out;
}

/* Hover label */
.minmap__label {
	/* Width set dynamically by JS */
	min-height: 24px;
	line-height: 16px;
	font-family: var(--font-display);
	font-size: 14px;
	font-weight: 400;
	color: var(--color-title);
	text-align: left;
	/* Allow 2 lines, then truncate */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Controls section */
.minmap__controls {
	/* Width set dynamically by JS */
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.minmap__controls-label {
	font-family: var(--font-display);
	font-size: 8px;
	font-weight: 400;
	color: #5E6A75;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.minmap__controls-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
}

/* Keyboard hints */
.minmap__keys {
	display: flex;
	gap: 4px;
}

.minmap__keys kbd {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 4px;
	font-family: var(--font-mono);
	font-size: 11px;
	color: var(--color-text-dim);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 3px;
}

/* ==========================================================================
   Passive Mode Toggle
   ========================================================================== */

.passive-toggle {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
	background: #fff;
	border: 1px solid var(--color-border);
	border-radius: 50%;
	color: var(--color-text);
	cursor: pointer;
	transition: color 150ms, border-color 150ms, background 150ms;
}

.passive-toggle:hover {
	background: #f5f5f5;
}

.passive-toggle__play,
.passive-toggle__pause {
	position: absolute;
	transition: opacity 150ms;
}

.passive-toggle__pause {
	opacity: 0;
}

.passive-toggle.is-playing .passive-toggle__play {
	opacity: 0;
}

.passive-toggle.is-playing .passive-toggle__pause {
	opacity: 1;
}

.passive-toggle.is-playing {
	background: var(--color-accent);
	border-color: var(--color-accent);
	color: #fff;
}

/* Hide back button during passive mode */
body.is-passive .back-btn {
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Slower transitions during passive mode */
body.is-passive .grid {
	transition: transform 1000ms var(--ease-out-expo);
}

body.is-passive .node.is-revealed {
	transition: clip-path 5s ease-in-out;
}

/* ==========================================================================
   Back Button (visible in immersive mode)
   ========================================================================== */

.back-btn {
	position: absolute;
	bottom: 0;
	left: 0;
	transform: translateY(40px);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	background: var(--color-panel);
	border: 1px solid var(--color-border);
	border-radius: 8px;
	backdrop-filter: blur(8px);
	font-family: var(--font-mono);
	font-size: 10px;
	color: var(--color-text-dim);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	/* Fast disappear, no delay */
	transition:
		opacity 200ms ease-out,
		transform 200ms ease-out;
}

.back-btn:hover {
	opacity: 1;
	color: var(--color-text);
}

.back-btn.is-visible {
	transform: translateY(0);
	opacity: 0.7;
	pointer-events: auto;
	/* Slow appear, delayed until minmap finishes sliding down */
	transition:
		opacity 400ms ease-out 800ms,
		transform 400ms ease-out 800ms;
}

/* ==========================================================================
   Edge Navigation (visible in immersive mode)
   ========================================================================== */

.edge-nav {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 100;
}

.edge-nav__btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: transparent;
	border: none;
	color: var(--color-text-dim);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transition: opacity 300ms ease, color 150ms ease;
}

.edge-nav__btn:hover {
	color: var(--color-text);
}

.edge-nav__btn--up {
	top: 24px;
	left: 50%;
	transform: translateX(-50%);
}

.edge-nav__btn--down {
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
}

.edge-nav__btn--left {
	left: 24px;
	top: 50%;
	transform: translateY(-50%);
}

.edge-nav__btn--right {
	right: 24px;
	top: 50%;
	transform: translateY(-50%);
}

/* Show only in immersive mode and only if direction is available */
.edge-nav__btn.is-available {
	opacity: 0.4;
	pointer-events: auto;
}

.edge-nav__btn.is-available:hover {
	opacity: 1;
}

/* Hide during passive mode */
body.is-passive .edge-nav__btn {
	opacity: 0 !important;
	pointer-events: none !important;
}

.minmap__grid {
	position: relative;
	/* Width and height set dynamically by JS */
	margin: 0;
}

.minmap__node {
	position: absolute;
	width: var(--minmap-node-w, 18px);
	height: var(--minmap-node-h, 10px);
	background: transparent;
	border: 1px solid var(--color-border);
	border-radius: 2px;
	padding: 0;
	cursor: pointer;
	transition: border-color 100ms, background 100ms;
}

.minmap__node:hover {
	border-color: var(--color-title);
}

/* Current node */
.minmap__node.is-current {
	background: var(--color-node-bg);
	border-color: var(--color-text);
}

/* Pulse animation when passive mode is active */
@keyframes passive-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

body.is-passive .minmap__node.is-current {
	animation: passive-pulse 2s ease-in-out infinite;
	border-color: var(--color-accent);
}

/* Row-based coloring for non-spine minmap nodes */
.minmap__node[data-row="title"] { background: var(--color-row-title); }
.minmap__node[data-row="beta"] { background: var(--color-row-beta); }
.minmap__node[data-row="sf"] { background: var(--color-row-sf); }
.minmap__node[data-row="wd"] { background: var(--color-row-wd); }
.minmap__node[data-row="ge"] { background: var(--color-row-ge); }
.minmap__node[data-row="archive"] { background: var(--color-row-archive); }
.minmap__node[data-row="closing"] { background: var(--color-row-closing); }

/* Spine nodes — neutral background with centered label */
.minmap__node--spine {
	background: var(--color-node-bg) !important;
	font-family: var(--font-display);
	font-size: 10px;
	font-weight: 400;
	color: var(--color-text-dim);
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
}

.minmap__node--spine.is-current {
	color: var(--color-text);
}

/* Locked/protected nodes — dashed border */
.minmap__node--locked {
	border-style: dashed;
	opacity: 0.6;
}

.minmap__node--locked:hover {
	opacity: 0.8;
}

/* ==========================================================================
   Theme Toggle
   ========================================================================== */

.theme-toggle {
	position: fixed;
	top: 24px;
	left: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: var(--color-panel);
	border: 1px solid var(--color-border);
	border-radius: 6px;
	backdrop-filter: blur(8px);
	color: var(--color-text-dim);
	cursor: pointer;
	z-index: 100;
	opacity: 0.7;
	transition: opacity 150ms, color 150ms;
}

.theme-toggle:hover {
	opacity: 1;
	color: var(--color-text);
}

/* Icon states: system (monitor), light (sun), dark (moon) */
/* Default: show system icon (no manual override) */
.theme-toggle__icon {
	display: none;
}

.theme-toggle__icon--system {
	display: block;
}

/* Light mode override: show sun */
[data-theme="light"] .theme-toggle__icon--system {
	display: none;
}

[data-theme="light"] .theme-toggle__icon--light {
	display: block;
}

/* Dark mode override: show moon */
[data-theme="dark"] .theme-toggle__icon--system {
	display: none;
}

[data-theme="dark"] .theme-toggle__icon--dark {
	display: block;
}

/* ==========================================================================
   Node Indicator
   ========================================================================== */

.node-indicator {
	position: fixed;
	top: 24px;
	right: 24px;
	height: 32px;
	display: flex;
	align-items: center;
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 400;
	color: var(--color-title);
	z-index: 100;
	opacity: 1;
	transition: opacity 2s ease-in-out;
}

.node-indicator.is-hidden {
	opacity: 0;
}

/* ==========================================================================
   Protected/Hidden Nodes
   ========================================================================== */

.is-protected-hidden {
	display: none !important;
}

/* ==========================================================================
   Locked Template (Password Gate)
   ========================================================================== */

.template-locked {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	padding: 48px;
	box-sizing: border-box;
}

.template-locked__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	max-width: 400px;
}

.template-locked__icon {
	margin-bottom: 24px;
	color: var(--color-text-dim);
}

.template-locked__title {
	margin-bottom: 8px;
}

.template-locked__description {
	margin-bottom: 32px;
	color: var(--color-text-dim);
}

.template-locked__form {
	display: flex;
	gap: 8px;
	width: 100%;
	max-width: 300px;
}

.template-locked__input {
	flex: 1;
	padding: 10px 14px;
	background: var(--color-panel);
	border: 1px solid var(--color-border);
	border-radius: 6px;
	font-family: var(--font-mono);
	font-size: 14px;
	color: var(--color-text);
	outline: none;
	transition: border-color 150ms;
}

.template-locked__input::placeholder {
	color: var(--color-text-dim);
}

.template-locked__input:focus {
	border-color: var(--color-accent);
}

.template-locked__submit {
	padding: 10px 20px;
	background: var(--color-accent);
	border: none;
	border-radius: 6px;
	font-family: var(--font-sans);
	font-size: 14px;
	font-weight: 700;
	color: #fff;
	cursor: pointer;
	transition: opacity 150ms;
}

.template-locked__submit:hover {
	opacity: 0.9;
}

.template-locked__submit:active {
	opacity: 0.8;
}

.template-locked__error {
	margin-top: 16px;
	min-height: 20px;
	font-family: var(--font-sans);
	font-size: 14px;
	color: var(--color-negative, #DE2E21);
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.grid {
		transition-duration: 0ms;
	}

	.node {
		transition-duration: 0ms;
	}
}

/* ==========================================================================
   Responsive — Tablet (max-width: 1023px)
   ========================================================================== */

@media (max-width: 1023px) {

	/* Reduce mask insets */
	:root {
		--mask-x: 4vw;
		--mask-y: 8vh;
	}

	/* Entry template: reduce gap */
	.template-entry {
		gap: 32px;
	}

	/* Detail template: reduce gap */
	.template-detail {
		gap: 32px;
	}

	/* Sections template: reduce gap */
	.template-sections__content {
		gap: 32px;
	}

	.template-sections__section--visual-left,
	.template-sections__section--visual-right {
		gap: 16px 32px;
	}

	.template-sections__columns {
		gap: 32px;
	}

	/* Contact icons: reduce gap */
	.template-contact__icons {
		gap: 32px;
	}
}

/* ==========================================================================
   Responsive — Mobile (max-width: 767px)
   ========================================================================== */

@media (max-width: 767px) {

	/* Reduce mask insets for more content space */
	:root {
		--mask-x: 3vw;
		--mask-y: 5vh;
	}

	/* Entry template: stack to single column */
	.template-entry {
		grid-template-columns: 1fr;
		grid-template-rows: auto;
		gap: 24px;
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 24px);
		text-align: center;
	}

	.template-entry__text {
		align-items: center;
		max-width: 100%;
	}

	.template-entry__meta {
		justify-content: center;
		flex-wrap: wrap;
	}

	.template-entry__tagline {
		text-align: center;
	}

	.template-entry__logo img {
		max-height: clamp(80px, 20vw, 128px);
	}

	.template-entry__visual {
		display: none; /* Hide visual on mobile to prioritize text */
	}

	/* Detail template: stack to single column */
	.template-detail {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
		gap: 24px;
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 24px);
	}

	.template-detail__text {
		max-width: 100%;
	}

	.template-detail--image-left .template-detail__visual {
		order: 0; /* Image after text on mobile */
	}

	/* Sections template: single column layouts, extra bottom padding for minmap */
	.template-sections {
		padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 24px) calc(var(--mask-y) + 120px);
	}

	.template-sections__content {
		gap: 32px;
	}

	.template-sections__section--visual-left,
	.template-sections__section--visual-right {
		display: flex;
		flex-direction: column;
		gap: 24px;
	}

	.template-sections__section--visual-left > .template-sections__subtitle,
	.template-sections__section--visual-right > .template-sections__subtitle {
		margin-bottom: 0;
	}

	.template-sections__section--visual-left > .template-sections__visual,
	.template-sections__section--visual-right > .template-sections__visual {
		order: 1; /* Visual after text */
	}

	.template-sections__section--visual-left > .template-sections__text,
	.template-sections__section--visual-right > .template-sections__text {
		order: 0;
	}

	/* Quote layout: stack vertically */
	.template-sections__text:has(.template-sections__quote) {
		display: flex;
		flex-direction: column;
		gap: 24px;
	}

	.template-sections__quote {
		max-width: 100%;
		font-size: 24px;
	}

	/* Columns layout: single column */
	.template-sections__columns {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	/* Video template: don't anchor to bottom on mobile */
	.template-video__header {
		padding: calc(var(--mask-y) + 24px) calc(var(--mask-x) + 16px) 16px;
	}

	.template-video__container {
		padding: 0 calc(var(--mask-x) + 16px);
		align-items: flex-start; /* Don't anchor to bottom */
	}

	.template-video__player,
	.template-video__image {
		border-radius: 8px; /* Uniform radius, not docked */
	}

	.template-video__caption {
		bottom: 60px;
		max-width: 90%;
	}

	/* Cropped template: reduce viewport inset, enlarge controls */
	.template-cropped__viewport {
		inset: 24px;
	}

	.template-cropped__dot {
		width: 12px;
		height: 12px;
	}

	.template-cropped__label {
		bottom: 60px;
		max-width: 90%;
	}

	/* Artifact template: reduce overlay insets */
	.template-artifact {
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 16px);
	}

	.template-artifact__overlay {
		bottom: 48px;
		left: 48px;
		right: 48px;
		flex-direction: column;
		align-items: flex-start;
	}

	.template-artifact__caption {
		max-width: 100%;
		text-align: left;
	}

	/* Intro template: scale logo */
	.template-intro__logo {
		width: clamp(160px, 50vw, 256px);
		height: clamp(160px, 50vw, 256px);
	}

	/* Contact template: wrap icons */
	.template-contact {
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 24px);
	}

	.template-contact__icons {
		gap: 24px;
		flex-wrap: wrap;
		justify-content: flex-start;
	}

	.template-contact__statement {
		font-size: 28px;
		line-height: 36px;
	}

	/* Index template: extra bottom padding for minmap */
	.template-index {
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 24px) calc(var(--mask-y) + 120px);
		gap: 32px;
	}

	/* Text template: extra bottom padding for minmap */
	.template-text {
		padding: calc(var(--mask-y) + 16px) calc(var(--mask-x) + 24px) calc(var(--mask-y) + 120px);
	}

	/* Locked template: reduce padding */
	.template-locked {
		padding: 24px;
	}

	/* Minmap on mobile: smaller, hide keyboard hints */
	.minmap {
		padding: 12px;
		gap: 8px;
	}

	.minmap__keys {
		display: none;
	}

	.minmap__controls-label {
		display: none;
	}

	.minmap__label {
		font-size: 12px;
		min-height: 18px;
	}

	/* Back button on mobile */
	.back-btn {
		font-size: 11px;
	}

	.back-btn span {
		display: none; /* Hide "minmap" text, keep just the icon */
	}

	/* Edge navigation visible on mobile for directional hints */
	.edge-nav__btn {
		opacity: 0.3;
		pointer-events: auto;
	}

	.edge-nav__btn.is-available {
		opacity: 0.5;
	}

	/* Theme toggle: adjust position */
	.theme-toggle {
		top: 16px;
		left: 16px;
	}

	/* Node indicator: adjust position */
	.node-indicator {
		top: 16px;
		right: 16px;
	}

	/* Nav panel: reposition on mobile */
	.nav-panel {
		left: 12px;
		bottom: 12px;
	}

	/* Typography adjustments */
	.t-title--display {
		font-size: 36px;
		line-height: 44px;
	}

	.t-title {
		font-size: 28px;
		line-height: 36px;
	}

	.t-statement {
		font-size: 24px;
		line-height: 32px;
	}
}

