/**
 * ACM TAPS-style CSS for academic papers
 * Professional, clean, and readable design
 */

/* ========== CSS Reset & Base Styles ========== */

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	font-size: 16px;
	line-height: 1.6;
	scroll-behavior: smooth;
}

body {
	font-family: "Charter", "Georgia", "Times New Roman", serif;
	color: #121212;
	background-color: #fff;
	background-image: url("groovepaper.png");
	padding: 0 1rem;
	max-width: 1200px;
	margin: 0 auto;
	overflow-wrap: normal;
	word-break: normal;
	hyphens: none;
}

/* ========== Typography ========== */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: "Helvetica Neue", "Arial", sans-serif;
	font-weight: 600;
	line-height: 1.3;
	margin-top: 1.5rem;
	margin-bottom: 0.75rem;
	color: #000;
}

.section-number {
	color: #666;
}

h1 {
	font-size: 2rem;
	margin-top: 0;
}

h2 {
	font-size: 1.5rem;
	border-bottom: 2px solid #e0e0e0;
	padding-bottom: 0.25rem;
	margin-top: 2rem;
}

h3 {
	font-size: 1.25rem;
}

h4 {
	font-size: 1.1rem;
}

p {
	margin-bottom: 1rem;
	text-align: justify;
	hyphens: none;
}

a {
	color: #2b93ef;
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: #5aadff;
	text-decoration: underline;
}

strong {
	font-weight: 600;
}

em {
	font-style: italic;
}

.smallcaps {
	font-variant: small-caps;
	letter-spacing: 0.05em;
}

blockquote {
	margin: 1em 2em;
	padding: 0.5em 1em;
	border-left: 3px solid #ccc;
	color: #555;
	font-style: italic;
}

/* Font size utilities (LaTeX \tiny … \Huge) */
.fs-tiny {
	font-size: 0.5em;
}
.fs-scriptsize {
	font-size: 0.7em;
}
.fs-footnotesize {
	font-size: 0.8em;
}
.fs-large {
	font-size: 1.2em;
}
.fs-Large {
	font-size: 1.44em;
}
.fs-LARGE {
	font-size: 1.73em;
}
.fs-huge {
	font-size: 2em;
}
.fs-Huge {
	font-size: 2.4em;
}

/* Font family utilities */
.font-sans {
	font-family: sans-serif;
}

/* Slanted text (\textsl) */
em.slanted {
	font-style: italic;
}

/* ========== Main Container ========== */

.acm-paper {
	background: transparent;
	padding: 2rem;
	min-height: 100vh;
	border-left: 1px solid rgba(0, 0, 0, 0.08);
	border-right: 1px solid rgba(0, 0, 0, 0.08);
}

/* ========== Header Section ========== */

.paper-header {
	text-align: center;
	margin-bottom: 2rem;
	padding-bottom: 2rem;
	border-bottom: 3px solid #333;
}

.paper-title {
	font-size: 2.25rem;
	font-weight: 700;
	margin-bottom: 1.5rem;
	line-height: 1.2;
}

.authors {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1.5rem 2rem;
	margin: 1.5rem auto;
	max-width: 900px;
}

.author {
	flex: 0 0 220px;
	text-align: center;
}

.author-name {
	font-weight: 600;
	font-size: 1rem;
	margin-bottom: 0.2rem;
}

.author-email {
	font-size: 0.875rem;
	color: #666;
	margin-bottom: 0.35rem;
}

.author-affiliation {
	font-size: 0.875rem;
	color: #444;
	line-height: 1.4;
}

.author-affiliation-line {
	display: block;
}

.orcid {
	font-size: 0.75rem;
	margin-left: 0.25rem;
	text-decoration: none;
}

.conference-info {
	margin-top: 1rem;
	font-style: italic;
	color: #555;
}

.publication-meta {
	margin-top: 0.75rem;
	font-size: 0.875rem;
	color: #666;
}

/* ========== Video Embed ========== */

.paper-video {
	margin: 2rem 0;
	width: 100%;
	text-align: left;
}

.video-container {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%; /* 16:9 aspect ratio */
	background: #000;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.video-container iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ========== Abstract & Keywords ========== */

.abstract {
	background: rgba(0, 0, 0, 0.03);
	border-left: 4px solid #2b93ef;
	padding: 1.5rem;
	margin: 2rem 0;
}

.abstract h2 {
	font-size: 1.25rem;
	margin-top: 0;
	margin-bottom: 1rem;
	border-bottom: none;
}

.ccs-concepts {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #ddd;
}

.ccs-concepts h3 {
	font-size: 1rem;
	margin-bottom: 0.5rem;
}

.ccs-concepts ul {
	list-style: none;
	font-size: 0.9rem;
	color: #444;
}

.ccs-concepts li:before {
	content: "• ";
	color: #2b93ef;
	font-weight: bold;
	margin-right: 0.5rem;
}

.keywords {
	margin-top: 1rem;
	font-size: 0.9rem;
	padding-top: 1rem;
	border-top: 1px solid #ddd;
}

/* ========== Action Bar (Cite & Download) ========== */

.action-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem;
	margin: 1.5rem 0 2rem;
	padding: 1rem 1.25rem;
	background: rgba(0, 0, 0, 0.03);
	border: 1px solid #e0e0e0;
	border-radius: 6px;
}

.action-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 1rem;
	font-family: "Helvetica Neue", "Arial", sans-serif;
	font-size: 0.85rem;
	font-weight: 500;
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
	transition:
		background 0.15s ease,
		border-color 0.15s ease;
	white-space: nowrap;
	line-height: 1.4;
}

.cite-btn,
.bibtex-btn {
	background: #fff;
	color: #333;
	border: 1px solid #ccc;
}

.bibtex-btn {
	background: #f0f7ff;
	border-color: #9dc2f5;
	color: #1f4e79;
}

.cite-btn:hover,
.bibtex-btn:hover {
	background: #f0f0f0;
	border-color: #999;
}

.bibtex-btn:hover {
	background: #e2eefc;
	border-color: #6ea4ee;
	color: #1a4470;
}

.cite-btn.copied,
.bibtex-btn.copied {
	background: #e8f5e9;
	border-color: #66bb6a;
	color: #2e7d32;
}

.pdf-btn {
	background: #d6001c;
	color: #fff;
	border: 1px solid #d6001c;
}

.pdf-btn:hover {
	background: #b3001a;
	border-color: #b3001a;
	color: #fff;
	text-decoration: none;
}

.action-label {
	pointer-events: none;
}

.citation-text {
	flex-basis: 100%;
	font-size: 1rem;
	line-height: 1.55;
	color: #121212;
	margin-top: 0.25rem;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 0.5rem 0.75rem;
}

@media (max-width: 600px) {
	.action-bar {
		padding: 0.75rem;
	}

	.action-btn {
		flex: 1;
		justify-content: center;
	}
}

/* ========== Teaser Figure ========== */

.teaser-figure {
	margin: 2rem 0;
	text-align: center;
}

.teaser-figure img,
.teaser-figure object,
.teaser-figure embed {
	max-width: 100%;
	height: auto;
	border: 1px solid #ddd;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.teaser-figure figcaption {
	margin-top: 1rem;
	font-size: 0.9rem;
	color: #444;
	text-align: left;
	padding: 0 2rem;
}

/* ========== Main Content ========== */

.content {
	/* Single-column layout by default */
	margin-top: 2rem;
}

/* Two-column layout - only when explicitly enabled */
.content.two-column {
	column-count: 2;
	column-gap: 2rem;
	column-rule: 1px solid #e0e0e0;
}

.section {
	break-inside: avoid;
	margin-bottom: 1.5rem;
}

.section h2,
.section h3,
.section h4 {
	break-after: avoid;
}

/* Prevent column breaks in certain elements */
figure,
table,
.citation-preview {
	break-inside: avoid;
}

/* ========== Figures ========== */

figure {
	margin: 1.5rem 0;
	text-align: center;
}

figure img,
figure object,
figure embed {
	max-width: 100%;
	height: auto;
	border: 1px solid #ddd;
}

.figure-media {
	width: 100%;
	display: block;
}

.figure-pdf {
	height: 520px;
}

.figure-pdf-frame {
	width: 100%;
	aspect-ratio: var(--pdf-w) / var(--pdf-h);
}

.figure-pdf-frame .figure-pdf {
	width: 100%;
	height: 100%;
}

.figure-media-wrapper {
	position: relative;
	display: block;
	max-width: 100%;
}

.figure-description {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 0.75rem 1rem;
	font-size: 0.85rem;
	line-height: 1.4;
	color: #fff;
	background: rgba(0, 0, 0, 0.72);
	opacity: 0;
	transform: translateY(6px);
	transition:
		opacity 0.2s ease,
		transform 0.2s ease;
	max-height: 50%;
	overflow: auto;
	pointer-events: none;
}

.figure-media-wrapper:hover .figure-description,
.figure-media-wrapper:focus .figure-description,
.figure-media-wrapper:focus-within .figure-description {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.figure-description {
		transition: none;
		transform: none;
	}
}

figcaption {
	margin-top: 0.75rem;
	font-size: 0.875rem;
	color: #444;
	text-align: left;
}

/* ========== Subfigures ========== */

.subfigure-row {
	display: flex;
	gap: 1rem;
	justify-content: center;
	align-items: flex-start;
}

.subfigure {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
	text-align: center;
}

.subfigure .figure-media-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	width: 100%;
}

.subfigure .figure-media {
	width: 100%;
	max-height: 500px;
	height: auto;
	object-fit: contain;
}

.subfigure .figure-pdf-frame {
	width: 100%;
	aspect-ratio: auto;
}

.subfigure .figure-pdf-frame .figure-pdf {
	width: 100%;
	height: auto;
	max-height: 500px;
}

.subfigure figcaption {
	font-size: 0.8rem;
	margin-top: 0.4rem;
	flex-shrink: 0;
}

/* ========== Tables ========== */

table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.5rem 0;
	font-size: 0.875rem;
}

th,
td {
	padding: 0.5rem;
	border: 1px solid #ddd;
	text-align: left;
}

th {
	background: rgba(0, 0, 0, 0.04);
	font-weight: 600;
}

caption {
	caption-side: top;
	text-align: left;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

/* ========== Lists ========== */

ul,
ol {
	margin-left: 1.5rem;
	margin-bottom: 1rem;
}

li {
	margin-bottom: 0.5rem;
}

/* ========== Citations & References ========== */

.citation-group {
	white-space: nowrap;
}

.citation {
	color: #2b93ef;
	text-decoration: none;
	font-weight: 500;
	white-space: nowrap;
	position: relative;
	cursor: pointer;
}

.citation:hover {
	text-decoration: underline;
	background-color: #fffacd;
}

.citation.active {
	background-color: #ffeb3b;
}

/* Citation preview tooltip */
.citation-preview {
	position: absolute;
	background: white;
	border: 1px solid #333;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	padding: 0.75rem;
	max-width: 350px;
	z-index: 1000;
	font-size: 0.875rem;
	line-height: 1.4;
	display: none;
}

.citation-preview.visible {
	display: block;
}

.citation-preview .preview-authors {
	font-weight: 600;
	color: #333;
}

.citation-preview .preview-title {
	margin-top: 0.25rem;
	font-style: italic;
	color: #444;
}

.citation-preview .preview-year {
	margin-top: 0.25rem;
	color: #666;
}

/* References section */
.references {
	column-span: all;
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 3px solid #333;
}

.references h2 {
	font-size: 1.75rem;
	margin-bottom: 1rem;
}

.reference-list {
	list-style: decimal;
	margin-left: 2rem;
}

.reference-list li {
	margin-bottom: 1rem;
	font-size: 0.9rem;
	line-height: 1.6;
	text-align: left;
}

.reference-list li.highlighted {
	background-color: #fffacd;
	padding: 0.5rem;
	margin-left: -0.5rem;
	border-radius: 4px;
}

/* ========== Math Rendering ========== */

.math {
	overflow-x: auto;
}

mjx-container {
	overflow-x: auto;
	overflow-y: hidden;
}

/* ========== Responsive Design ========== */

@media (max-width: 900px) {
	/* Ensure single column on tablets */
	.content.two-column {
		column-count: 1;
		column-rule: none;
	}

	.authors {
		max-width: 640px;
	}

	.author {
		flex: 0 0 200px;
	}
}

@media (max-width: 600px) {
	/* Mobile adjustments */
	body {
		padding: 1rem 0.5rem;
	}

	.acm-paper {
		padding: 1rem;
	}

	.paper-title {
		font-size: 1.75rem;
	}

	h2 {
		font-size: 1.25rem;
	}

	.teaser-figure figcaption {
		padding: 0;
	}

	p {
		text-align: left;
	}

	.authors {
		max-width: 100%;
	}

	.author {
		flex: 0 0 100%;
	}
}

/* ========== Print Styles ========== */

@media print {
	body {
		background: white;
		background-image: none;
		max-width: none;
	}

	.content {
		column-count: 2;
	}

	a {
		color: black;
		text-decoration: underline;
	}

	.citation-preview {
		display: none !important;
	}

	.theme-switch {
		display: none;
	}
}

/* ========== Accessibility ========== */

/* Focus states for keyboard navigation */
a:focus,
.citation:focus {
	outline: 2px solid #2b93ef;
	outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
	position: absolute;
	top: -40px;
	left: 0;
	background: #000;
	color: #fff;
	padding: 8px;
	text-decoration: none;
	z-index: 100;
}

.skip-to-main:focus {
	top: 0;
}

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

.theme-switch {
	position: fixed;
	top: 24px;
	left: 24px;
	background-color: #121212;
	width: 35px;
	height: 35px;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 50%;
	cursor: pointer;
	z-index: 1000;
	transition: background-color 0.2s ease;
	border: none;
	padding: 0;
}

.theme-switch i {
	color: white;
	font-size: 14px;
}

.theme-switch:hover {
	opacity: 0.85;
}

/* ========== Dark Theme ========== */
/* Matches driescardinaels.be color scheme */
/* Activated via data-theme="dark" on <html>, toggled by JS */

[data-theme="dark"] body {
	color: white;
	background-color: #121212;
	background-image: none;
}

[data-theme="dark"] body::before {
	content: "";
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image: url("groovepaper.png");
	filter: invert(1);
	opacity: 1;
	pointer-events: none;
	z-index: -1;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
	color: white;
}

[data-theme="dark"] .section-number {
	color: #b4b4b4;
}

[data-theme="dark"] h2 {
	border-bottom-color: #333;
}

[data-theme="dark"] a {
	color: #2b93ef;
}

[data-theme="dark"] a:hover {
	color: #5aadff;
}

[data-theme="dark"] a:focus,
[data-theme="dark"] .citation:focus {
	outline-color: #2b93ef;
}

/* Theme toggle in dark mode */
[data-theme="dark"] .theme-switch {
	background-color: white;
}

[data-theme="dark"] .theme-switch i {
	color: #121212;
}

/* Main container */
[data-theme="dark"] .acm-paper {
	background: transparent;
	border-left-color: rgba(255, 255, 255, 0.1);
	border-right-color: rgba(255, 255, 255, 0.1);
}

/* Header */
[data-theme="dark"] .paper-header {
	border-bottom-color: #b4b4b4;
}

[data-theme="dark"] .author-email {
	color: #b4b4b4;
}

[data-theme="dark"] .author-affiliation {
	color: #b4b4b4;
}

[data-theme="dark"] .conference-info {
	color: #b4b4b4;
}

[data-theme="dark"] .publication-meta {
	color: #b4b4b4;
}

/* Abstract */
[data-theme="dark"] .abstract {
	background: #1a1a1a;
	border-left-color: #2b93ef;
}

[data-theme="dark"] .ccs-concepts {
	border-top-color: #333;
}

[data-theme="dark"] .ccs-concepts ul {
	color: #b4b4b4;
}

[data-theme="dark"] .ccs-concepts li:before {
	color: #2b93ef;
}

[data-theme="dark"] .keywords {
	border-top-color: #333;
}

/* Action bar */
[data-theme="dark"] .action-bar {
	background: #1a1a1a;
	border-color: #333;
}

[data-theme="dark"] .cite-btn,
[data-theme="dark"] .bibtex-btn {
	background: #2a2a2a;
	color: white;
	border-color: #444;
}

[data-theme="dark"] .bibtex-btn {
	background: #162a42;
	border-color: #2b6eb3;
	color: #5aadff;
}

[data-theme="dark"] .cite-btn:hover,
[data-theme="dark"] .bibtex-btn:hover {
	background: #333;
	border-color: #666;
}

[data-theme="dark"] .bibtex-btn:hover {
	background: #1e3855;
	border-color: #4090d0;
	color: #7ec0ff;
}

[data-theme="dark"] .cite-btn.copied,
[data-theme="dark"] .bibtex-btn.copied {
	background: #1b3a1e;
	border-color: #4caf50;
	color: #81c784;
}

[data-theme="dark"] .pdf-btn {
	background: #ff7a7a;
	color: #121212;
	border-color: #ff7a7a;
}

[data-theme="dark"] .pdf-btn:hover {
	background: #ff9a9a;
	border-color: #ff9a9a;
	color: #121212;
}

[data-theme="dark"] .citation-text {
	color: white;
	background: #2a2a2a;
	border-color: #444;
}

/* Figures */
[data-theme="dark"] figure img,
[data-theme="dark"] figure object,
[data-theme="dark"] figure embed {
	border-color: #333;
}

[data-theme="dark"] .teaser-figure img,
[data-theme="dark"] .teaser-figure object,
[data-theme="dark"] .teaser-figure embed {
	border-color: #333;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] figcaption {
	color: #b4b4b4;
}

[data-theme="dark"] .teaser-figure figcaption {
	color: #b4b4b4;
}

[data-theme="dark"] .figure-description {
	background: rgba(0, 0, 0, 0.85);
}

/* Tables */
[data-theme="dark"] th,
[data-theme="dark"] td {
	border-color: #333;
	color: white;
}

[data-theme="dark"] th {
	background: #1a1a1a;
}

/* Citations */
[data-theme="dark"] .citation {
	color: #2b93ef;
}

[data-theme="dark"] .citation:hover {
	background-color: rgba(43, 147, 239, 0.12);
}

[data-theme="dark"] .citation.active {
	background-color: rgba(43, 147, 239, 0.2);
}

[data-theme="dark"] .citation-preview {
	background: #1e1e1e;
	border-color: #444;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .citation-preview .preview-authors {
	color: white;
}

[data-theme="dark"] .citation-preview .preview-title {
	color: #b4b4b4;
}

[data-theme="dark"] .citation-preview .preview-year {
	color: #6e6e6e;
}

/* References */
[data-theme="dark"] .references {
	border-top-color: #b4b4b4;
}

[data-theme="dark"] .reference-list li.highlighted {
	background-color: rgba(43, 147, 239, 0.12);
}

/* Two-column rule */
[data-theme="dark"] .content.two-column {
	column-rule-color: #333;
}

/* Video */
[data-theme="dark"] .video-container {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
