/* Content Innovation Explorer — styles */

/* --- Theme variables --- */

:root {
	--bg-page: #f5f5f5;
	--bg-surface: #fff;
	--bg-surface-alt: #fafafa;
	--bg-surface-alt2: #f3f3f3;
	--bg-code: #f8f8f8;
	--bg-input: #fff;
	--bg-btn-primary: #0066cc;
	--bg-btn-primary-hover: #0055aa;
	--bg-btn-hover: #f0f6ff;
	--bg-error: #fff5f5;
	--bg-copy-hover: #e8f0fe;
	--text-primary: #1a1a1a;
	--text-secondary: #444;
	--text-tertiary: #555;
	--text-muted: #666;
	--text-faint: #888;
	--text-disabled: #999;
	--text-code: #333;
	--link-color: #0066cc;
	--link-hover: #0066cc;
	--link-danger: #cc0000;
	--border-color: #ddd;
	--border-hover: #bbb;
	--border-light: #eee;
	--border-card: #e0e0e0;
	--border-input: #ccc;
	--focus-ring: rgba(0, 102, 204, 0.15);
	--error-text: #cc0000;
	--error-border: #ffcccc;
	color-scheme: light dark;
}

/* Dark theme via explicit attribute */
[data-theme="dark"] {
	--bg-page: #1a1a1a;
	--bg-surface: #252525;
	--bg-surface-alt: #2a2a2a;
	--bg-surface-alt2: #2f2f2f;
	--bg-code: #2a2a2a;
	--bg-input: #2d2d2d;
	--bg-btn-primary: #3b8eea;
	--bg-btn-primary-hover: #2b7cd4;
	--bg-btn-hover: #1e2d40;
	--bg-error: #3a1a1a;
	--bg-copy-hover: #1e2d40;
	--text-primary: #e0e0e0;
	--text-secondary: #ccc;
	--text-tertiary: #bbb;
	--text-muted: #aaa;
	--text-faint: #888;
	--text-disabled: #777;
	--text-code: #d0d0d0;
	--link-color: #6ab0f3;
	--link-hover: #6ab0f3;
	--link-danger: #f06060;
	--border-color: #444;
	--border-hover: #666;
	--border-light: #333;
	--border-card: #444;
	--border-input: #555;
	--focus-ring: rgba(106, 176, 243, 0.25);
	--error-text: #f06060;
	--error-border: #5a2020;
}

/* Dark theme via system preference (when no explicit choice) */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		--bg-page: #1a1a1a;
		--bg-surface: #252525;
		--bg-surface-alt: #2a2a2a;
		--bg-surface-alt2: #2f2f2f;
		--bg-code: #2a2a2a;
		--bg-input: #2d2d2d;
		--bg-btn-primary: #3b8eea;
		--bg-btn-primary-hover: #2b7cd4;
		--bg-btn-hover: #1e2d40;
		--bg-error: #3a1a1a;
		--bg-copy-hover: #1e2d40;
		--text-primary: #e0e0e0;
		--text-secondary: #ccc;
		--text-tertiary: #bbb;
		--text-muted: #aaa;
		--text-faint: #888;
		--text-disabled: #777;
		--text-code: #d0d0d0;
		--link-color: #6ab0f3;
		--link-hover: #6ab0f3;
		--link-danger: #f06060;
		--border-color: #444;
		--border-hover: #666;
		--border-light: #333;
		--border-card: #444;
		--border-input: #555;
		--focus-ring: rgba(106, 176, 243, 0.25);
		--error-text: #f06060;
		--error-border: #5a2020;
	}
}

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

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--text-primary);
	background: var(--bg-page);
	line-height: 1.5;
}

/* Header */

header {
	background: var(--bg-surface);
	border-bottom: 1px solid var(--border-color);
	position: sticky;
	top: 0;
	z-index: 100;
}

.header-inner {
	max-width: 900px;
	margin: 0 auto;
	padding: 12px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.header-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--text-primary);
	text-decoration: none;
}

.header-title:hover {
	color: var(--link-hover);
}

.header-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.user-info {
	font-size: 13px;
	color: var(--text-muted);
}

.user-info a {
	color: var(--text-muted);
	text-decoration: none;
	cursor: pointer;
}

.user-info a:hover {
	color: var(--link-danger);
	text-decoration: underline;
}

.docs-link {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
}

.docs-link:hover {
	color: inherit;
	text-decoration: none;
	opacity: 0.8;
}

/* Theme toggle */

.theme-toggle {
	background: none;
	border: 1px solid var(--border-color);
	border-radius: 6px;
	cursor: pointer;
	padding: 5px 7px;
	line-height: 0;
	font-size: 16px;
	color: var(--text-muted);
	transition: border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
	border-color: var(--border-hover);
	color: var(--text-primary);
}

/* Main content */

main {
	max-width: 900px;
	margin: 0 auto;
	padding: 24px 20px;
}

/* Search page */

.search-box {
	display: flex;
	gap: 8px;
	margin-bottom: 24px;
}

.search-box input {
	flex: 1;
	padding: 10px 14px;
	font-size: 16px;
	border: 1px solid var(--border-input);
	border-radius: 6px;
	outline: none;
	background: var(--bg-input);
	color: var(--text-primary);
}

.search-box input:focus {
	border-color: var(--link-color);
	box-shadow: 0 0 0 2px var(--focus-ring);
}

.search-box button {
	padding: 10px 20px;
	font-size: 16px;
	background: var(--bg-btn-primary);
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
}

.search-box button:hover {
	background: var(--bg-btn-primary-hover);
}

/* Result cards */

.result-card {
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	padding: 14px 18px;
	margin-bottom: 10px;
}

.result-card:hover {
	border-color: var(--border-hover);
}

.result-label {
	font-size: 16px;
	font-weight: 600;
}

.result-label a {
	color: var(--link-color);
	text-decoration: none;
}

.result-label a:hover {
	text-decoration: underline;
}

.result-meta {
	font-size: 13px;
	color: var(--text-muted);
	margin-top: 2px;
}

.result-id {
	display: flex;
	align-items: center;
	gap: 6px;
	font-family: monospace;
	font-size: 13px;
	color: var(--text-muted);
	margin-top: 2px;
}

.result-id-text {
	overflow-wrap: anywhere;
}

.result-dtrs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
	margin-top: 2px;
}

.result-dtr {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-family: monospace;
	font-size: 13px;
	color: var(--text-muted);
}

.result-dtr-text {
	overflow-wrap: anywhere;
}

.result-description {
	font-size: 14px;
	color: var(--text-secondary);
	margin-top: 6px;
}

/* More button */

.more-btn {
	display: block;
	width: 100%;
	padding: 10px;
	margin-top: 12px;
	font-size: 15px;
	background: var(--bg-surface);
	color: var(--link-color);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	cursor: pointer;
	text-align: center;
}

.more-btn:hover {
	background: var(--bg-btn-hover);
	border-color: var(--link-color);
}

/* Entity detail page */

.back-link {
	font-size: 14px;
	color: var(--link-color);
	text-decoration: none;
	white-space: nowrap;
}

.back-link:hover {
	text-decoration: underline;
}

.entity-header {
	margin-bottom: 24px;
}

.entity-title-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.entity-header h1 {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 4px;
}

.entity-header .entity-id {
	font-size: 14px;
	color: var(--text-muted);
	font-family: monospace;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.entity-header .entity-dtrs {
	font-size: 14px;
	color: var(--text-tertiary);
	margin-top: 4px;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 6px;
}

.entity-header .entity-dtr {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

/* Properties table */

.section-title {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 8px;
	margin-top: 24px;
}

.properties-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg-surface);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	overflow: hidden;
}

.properties-table th,
.properties-table td {
	padding: 8px 12px;
	text-align: left;
	border-bottom: 1px solid var(--border-light);
	vertical-align: top;
	font-size: 14px;
}

.properties-table th {
	font-weight: 600;
	color: var(--text-secondary);
	white-space: nowrap;
	width: 180px;
	background: var(--bg-surface-alt);
}

.properties-table tr:nth-child(even) {
	background: var(--bg-surface-alt);
}

.properties-table tr:nth-child(even) th {
	background: var(--bg-surface-alt2);
}

.properties-table tr:last-child th,
.properties-table tr:last-child td {
	border-bottom: none;
}

/* Value rendering */

.value-null {
	color: var(--text-disabled);
	font-style: italic;
}

.value-list {
	margin: 0;
	padding: 0;
}

.value-list-item {
	margin-bottom: 2px;
}

.localized-table {
	border-collapse: collapse;
	margin: 0;
	width: 100%;
}

.localized-table th {
	font-weight: 600;
	color: var(--text-muted);
	font-size: 12px;
	padding: 2px 0 2px 12px;
	vertical-align: top;
	white-space: nowrap;
	text-align: right;
	width: 5em;
}

.localized-table td {
	padding: 2px 0;
	vertical-align: top;
	font-size: 14px;
}

.entity-link {
	color: var(--link-color);
	text-decoration: none;
}

.entity-link:hover {
	text-decoration: underline;
}

.external-link {
	color: var(--text-muted);
	text-decoration: none;
	margin-left: 4px;
	vertical-align: middle;
	display: inline-flex;
	align-items: center;
}

.external-link:hover {
	color: var(--link-color);
}

.github-source-link {
	color: var(--text-muted);
	text-decoration: none;
	vertical-align: middle;
	display: inline-flex;
	align-items: center;
}

.github-source-link:hover {
	color: var(--link-color);
}

.entity-id-link {
	color: var(--link-color);
	text-decoration: none;
	font-family: monospace;
}

.entity-id-link:hover {
	text-decoration: underline;
}

/* Object cards in arrays */

.object-card {
	border: 1px solid var(--border-card);
	border-radius: 4px;
	padding: 8px 10px;
	margin-bottom: 6px;
	background: var(--bg-surface-alt);
}

.object-card:last-child {
	margin-bottom: 0;
}

.object-card .card-index {
	font-weight: 700;
	font-size: 12px;
	color: var(--text-faint);
	margin-bottom: 4px;
}

.sub-table {
	width: 100%;
	border-collapse: collapse;
}

.sub-table th,
.sub-table td {
	padding: 3px 8px;
	text-align: left;
	vertical-align: top;
	font-size: 13px;
}

.sub-table th {
	font-weight: 600;
	color: var(--text-tertiary);
	white-space: nowrap;
	width: 120px;
}

.compact-kv {
	font-size: 13px;
}

.compact-kv .kv-key {
	font-weight: 600;
	color: var(--text-tertiary);
}

/* Show-all toggle */

.show-all-toggle {
	font-size: 13px;
	color: var(--link-color);
	cursor: pointer;
	background: none;
	border: none;
	padding: 4px 0;
	margin-top: 4px;
}

.show-all-toggle:hover {
	text-decoration: underline;
}

/* Topic links */

.topic-links-container {
	margin-top: 12px;
}

.topic-links-btn {
	padding: 6px 14px;
	font-size: 13px;
	background: var(--bg-surface);
	color: var(--link-color);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	cursor: pointer;
}

.topic-links-btn:hover {
	background: var(--bg-btn-hover);
	border-color: var(--link-color);
}

.topic-links-btn:disabled {
	color: var(--text-disabled);
	cursor: default;
	background: var(--bg-surface-alt);
	border-color: var(--border-color);
}

.topic-links-empty {
	font-size: 13px;
	color: var(--text-faint);
}

/* Raw JSON */

.raw-json-wrapper {
	position: relative;
}

.copy-icon-btn {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--bg-code);
	border: 1px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	color: var(--text-disabled);
	padding: 4px;
	line-height: 0;
	opacity: 0;
	transition: opacity 0.15s;
}

.raw-json-wrapper:hover .copy-icon-btn {
	opacity: 1;
}

.copy-icon-btn:hover {
	color: var(--link-color);
	background: var(--bg-copy-hover);
	border-color: var(--border-input);
}

/* Inline copy buttons that sit next to ids / data type references */
.copy-icon-btn.copy-inline {
	position: static;
	opacity: 0;
	background: transparent;
	border-color: transparent;
	padding: 2px;
}

.result-card:hover .copy-inline,
.entity-id:hover .copy-inline,
.entity-dtr:hover .copy-inline,
.copy-inline:focus-visible {
	opacity: 1;
}

.copy-icon-btn.copy-inline:hover {
	opacity: 1;
	color: var(--link-color);
	background: var(--bg-copy-hover);
	border-color: var(--border-input);
}

.raw-json {
	background: var(--bg-code);
	border: 1px solid var(--border-color);
	border-radius: 6px;
	padding: 16px;
	max-height: 60vh;
	overflow: auto;
	font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
	font-size: 13px;
	line-height: 1.4;
	white-space: pre;
	color: var(--text-code);
}

/* Status messages */

.loading {
	color: var(--text-faint);
	font-size: 15px;
	padding: 20px 0;
}

.error-message {
	color: var(--error-text);
	background: var(--bg-error);
	border: 1px solid var(--error-border);
	border-radius: 6px;
	padding: 14px 18px;
	font-size: 14px;
}

.not-found {
	text-align: center;
	padding: 40px 0;
	color: var(--text-muted);
	font-size: 16px;
}

.result-count {
	font-size: 13px;
	color: var(--text-faint);
	margin-bottom: 12px;
}
