/* Reference page-specific styles */

/* ==========================================================================
   Dialog/Modal Styles for Demo Viewer
   ========================================================================== */

/* Main dialog element */
dialog {
	width: 1200px;
	max-width: 90vw;
	height: 800px;
	max-height: 85vh;
	border: none;
	border-radius: 0.75rem;
	padding: 0;
	box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
	position: fixed;
	inset: 0;
	margin: auto;
	overscroll-behavior: contain;
}

dialog[open] {
	display: flex;
	flex-direction: column;
}

/* Dialog backdrop with blur and scroll prevention */
dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
	overflow: hidden;
	overscroll-behavior: contain;
}

/* Dialog header with title and close button */
.dialog-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--color-border, #e5e7eb);
	background: var(--color-surface, #f9fafb);
}

.dialog-header h3 {
	margin: 0;
	font-size: 1.125rem;
	font-weight: 600;
}

/* Close button */
.dialog-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	color: var(--color-text-muted, #6b7280);
	border-radius: 0.25rem;
	transition: all 150ms ease;
}

.dialog-close:hover {
	background: var(--color-border, #e5e7eb);
	color: var(--color-text, #111827);
}

/* Dialog content area - contains the browser-window */
.dialog-content {
	padding: 1.5rem;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

/* Ensure browser-window expands to fill available space */
.dialog-content browser-window {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
}

/* Target the shadow DOM content of browser-window */
.dialog-content browser-window::part(content) {
	flex: 1;
	min-height: 0;
	height: 100%;
}

/* Ensure iframe inside browser-window expands */
.dialog-content iframe {
	flex: 1;
	min-height: 0 !important;
	height: 100% !important;
}

/* Demo and Spec Link Styles */
.demo-links {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}

.demo-link,
.spec-link-inline {
	font-size: 0.8125rem;
	font-weight: 500;
	text-decoration: none;
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	transition: all 150ms ease;
}

/* Demo link - green */
.demo-link {
	color: var(--color-primary, #16a34a);
	border: 1px solid var(--color-primary, #16a34a);
}

.demo-link:hover {
	background: var(--color-primary, #16a34a);
	color: white;
}

/* Spec link - gray */
.spec-link-inline {
	color: #6b7280;
	border: 1px solid var(--color-border, #e5e7eb);
}

.spec-link-inline:hover {
	background: var(--color-surface, #f9fafb);
	border-color: #6b7280;
}

/* Section heading links */
.reference-category h3 a {
	color: inherit;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	transition: color 150ms ease;
}

.reference-category h3 a::after {
	content: "→";
	font-size: 0.875em;
	opacity: 0;
	transition: opacity 150ms ease, transform 150ms ease;
	transform: translateX(-4px);
}

.reference-category h3 a:hover {
	color: var(--color-primary, #16a34a);
}

.reference-category h3 a:hover::after {
	opacity: 1;
	transform: translateX(0);
}

/* Resources Section */
.resources {
	margin-top: 3rem;
	padding: 1.5rem;
	background: var(--color-surface, #f9fafb);
	border-radius: 0.5rem;
}

.resources h2 {
	margin-top: 0;
	margin-bottom: 1rem;
}

.resources p {
	color: var(--color-text-muted, #6b7280);
	margin-bottom: 1rem;
	font-size: 0.875rem;
}

.resource-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: grid;
	gap: 0.5rem;
}

.resource-list li {
	margin: 0;
}

.resource-list a {
	display: block;
	padding: 0.75rem 1rem;
	background: white;
	border: 1px solid var(--color-border, #e5e7eb);
	border-radius: 0.375rem;
	text-decoration: none;
	color: var(--color-text, #111827);
	transition: all 150ms ease;
}

.resource-list a:hover {
	border-color: var(--color-primary, #16a34a);
	background: var(--color-surface, #f9fafb);
	transform: translateX(4px);
}

.resource-list a::after {
	content: " →";
	color: var(--color-text-muted, #6b7280);
	float: right;
}

/* ==========================================================================
   End Dialog/Modal Styles
   ========================================================================== */

/* Reference Index Page */
.reference-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
	gap: 1.5rem;
	margin: 2rem 0;
}

.reference-card {
	background: white;
	border-radius: 0.75rem;
	padding: 1.75rem;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
	border: 1px solid var(--color-border, #e5e7eb);
	display: flex;
	flex-direction: column;
	gap: 1rem;
	transition: all 200ms ease;
}

.reference-card:hover {
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
	transform: translateY(-2px);
	border-color: var(--color-primary, #16a34a);
}

.reference-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
}

.reference-card h3 {
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--color-text, #111827);
	margin: 0;
}

.reference-badge {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	background: #f3f4f6;
	color: #6b7280;
	border-radius: 0.375rem;
	font-size: 0.75rem;
	font-weight: 500;
	white-space: nowrap;
}

.reference-card p {
	font-size: 0.875rem;
	color: var(--color-text-muted, #6b7280);
	line-height: 1.75;
	flex: 1;
	margin: 0;
}

.reference-card-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--color-primary, #16a34a);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.875rem;
	transition: color 150ms ease;
}

.reference-card-link:hover {
	color: #065f46;
}

.reference-card-link::after {
	content: "";
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid currentColor;
	border-top: 3px solid transparent;
	border-bottom: 3px solid transparent;
	transition: transform 150ms ease;
}

.reference-card:hover .reference-card-link::after {
	transform: translateX(4px);
}

/* Introduction card */
.intro-card {
	background: white;
	padding: 2rem;
	border-radius: 0.75rem;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
	margin-bottom: 2rem;
	border: 1px solid var(--color-border, #e5e7eb);
}

.intro-card h2 {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--color-text, #111827);
	margin-bottom: 1rem;
}

.intro-card p {
	color: var(--color-text-muted, #6b7280);
	line-height: 1.6;
	margin-bottom: 1rem;
}

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

/* Related tutorials */
.related-tutorials {
	background: #f3f4f6;
	padding: 1.5rem;
	border-radius: 0.75rem;
	margin-bottom: 2rem;
	border: 1px solid var(--color-border, #e5e7eb);
}

.related-tutorials h3 {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--color-text, #111827);
	margin-bottom: 1rem;
}

.related-tutorials ul {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 0.5rem;
}

.related-tutorials li {
	margin: 0;
}

.related-tutorials a {
	display: block;
	padding: 0.75rem 1rem;
	background: white;
	color: var(--color-text, #111827);
	text-decoration: none;
	border-radius: 0.5rem;
	border: 1px solid var(--color-border, #e5e7eb);
	transition: all 150ms ease;
	font-size: 0.875rem;
	font-weight: 500;
}

.related-tutorials a:hover {
	background: var(--color-primary, #16a34a);
	color: white;
	border-color: var(--color-primary, #16a34a);
	transform: translateY(-1px);
	box-shadow: 0 2px 4px 0 rgb(0 0 0 / 0.1);
}

/* Specifications section */
.specifications {
	background: white;
	padding: 2rem;
	border-radius: 0.75rem;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
	margin-top: 3rem;
	border: 1px solid var(--color-border, #e5e7eb);
}

.specifications h2 {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--color-text, #111827);
	margin-bottom: 1rem;
}

.specifications ul {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.specifications li {
	margin: 0;
}

.specifications a {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	background: #1f2937;
	color: white;
	text-decoration: none;
	border-radius: 0.5rem;
	font-weight: 600;
	font-size: 0.875rem;
	transition: all 200ms ease;
}

.specifications a:hover {
	background: #111827;
	transform: translateX(4px);
}

.specifications a::after {
	content: "→";
	font-size: 1.125rem;
}

/* Reference table styling */
.reference-table {
	width: 100%;
	border-collapse: collapse;
	margin: 2rem 0;
	background: white;
	border-radius: 0.5rem;
	overflow: hidden;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.reference-table thead {
	background: var(--color-surface, #f9fafb);
	border-bottom: 2px solid var(--color-border, #e5e7eb);
}

.reference-table th {
	padding: 0.75rem 1rem;
	text-align: left;
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--color-text, #111827);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.reference-table td {
	padding: 1rem;
	border-bottom: 1px solid var(--color-border, #e5e7eb);
	vertical-align: top;
}

.reference-table tbody tr:last-child td {
	border-bottom: none;
}

.reference-table tbody tr:hover {
	background: var(--color-surface, #f9fafb);
}

/* Code in tables */
.reference-table code {
	background: #f3f4f6;
	color: #1f2937;
	padding: 0.125rem 0.375rem;
	border-radius: 0.25rem;
	font-size: 0.875rem;
	font-family: 'Monaco', 'Courier New', monospace;
	font-weight: 500;
}

/* Example column styling */
.reference-table .example {
	font-family: 'Monaco', 'Courier New', monospace;
	font-size: 0.8125rem;
	color: #6b7280;
}

/* Browser support badges - NO BLUE COLORS */
.support-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.25rem 0.625rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	white-space: nowrap;
}

.support-badge::before {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
}

/* Excellent support - Green */
.support-badge.excellent {
	background: #dcfce7;
	color: #166534;
}

.support-badge.excellent::before {
	background: #166534;
}

/* Good support - Teal */
.support-badge.good {
	background: #d1fae5;
	color: #065f46;
}

.support-badge.good::before {
	background: #065f46;
}

/* Modern support - Yellow/Amber */
.support-badge.modern {
	background: #fef3c7;
	color: #92400e;
}

.support-badge.modern::before {
	background: #92400e;
}

/* Experimental - Orange */
.support-badge.experimental {
	background: #fed7aa;
	color: #9a3412;
}

.support-badge.experimental::before {
	background: #9a3412;
}

/* Deprecated - Red */
.support-badge.deprecated {
	background: #fee2e2;
	color: #991b1b;
}

.support-badge.deprecated::before {
	background: #991b1b;
}

/* Webkit-specific - Gray (not blue) */
.support-badge.webkit {
	background: #e5e7eb;
	color: #374151;
}

.support-badge.webkit::before {
	background: #374151;
}

/* Link styling in tables */
.reference-table a {
	color: #374151;
	text-decoration: none;
	font-weight: 500;
	font-size: 0.8125rem;
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	border: 1px solid var(--color-border, #e5e7eb);
	display: inline-block;
	transition: all 150ms ease;
}

.reference-table a:hover {
	background: var(--color-surface, #f9fafb);
	border-color: #374151;
}

/* Category sections */
.reference-category {
	margin: 3rem 0;
}

.reference-category:first-of-type {
	margin-top: 2rem;
}

.reference-category h3 {
	font-size: 1.5rem;
	font-weight: 600;
	color: var(--color-text, #111827);
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--color-primary, #16a34a);
}

/* Note/tip boxes in reference */
.reference-note {
	background: #f3f4f6;
	border-left: 4px solid #6b7280;
	padding: 1rem 1.5rem;
	margin: 1.5rem 0;
	border-radius: 0.5rem;
}

.reference-note strong {
	display: block;
	margin-bottom: 0.5rem;
	color: var(--color-text, #111827);
}

.reference-tip {
	background: #d1fae5;
	border-left: 4px solid #065f46;
	padding: 1rem 1.5rem;
	margin: 1.5rem 0;
	border-radius: 0.5rem;
}

.reference-tip strong {
	display: block;
	margin-bottom: 0.5rem;
	color: #065f46;
}

/* Spec link button - NO BLUE */
.spec-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	background: #1f2937;
	color: white;
	text-decoration: none;
	border-radius: 0.5rem;
	font-weight: 600;
	font-size: 0.875rem;
	transition: all 200ms ease;
	margin: 1rem 0;
}

.spec-link:hover {
	background: #111827;
	transform: translateY(-1px);
	box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.spec-link::after {
	content: "→";
	font-size: 1.125rem;
}

/* Responsive table handling */
@media (max-width: 768px) {
	.reference-table {
		font-size: 0.875rem;
	}

	.reference-table th,
	.reference-table td {
		padding: 0.5rem;
	}

	/* Hide less critical columns on mobile */
	.reference-table .example-col {
		display: none;
	}
}

/* Table of contents for quick navigation */
.reference-toc {
	background: white;
	padding: 1.5rem;
	border-radius: 0.75rem;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
	margin-bottom: 2rem;
	border: 1px solid var(--color-border, #e5e7eb);
}

.reference-toc h2 {
	font-size: 1.125rem;
	font-weight: 600;
	margin-bottom: 1rem;
	color: var(--color-text, #111827);
}

.reference-toc ul {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 0.5rem;
}

.reference-toc a {
	display: block;
	padding: 0.5rem 0.75rem;
	color: var(--color-text-muted, #6b7280);
	text-decoration: none;
	border-radius: 0.375rem;
	transition: all 150ms ease;
	font-size: 0.875rem;
}

.reference-toc a:hover {
	background: var(--color-surface, #f9fafb);
	color: var(--color-text, #111827);
}

/* Statistics/info boxes */
.reference-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1rem;
	margin: 2rem 0;
}

.reference-stat {
	background: white;
	padding: 1.5rem;
	border-radius: 0.5rem;
	box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
	text-align: center;
	border: 1px solid var(--color-border, #e5e7eb);
}

.reference-stat-value {
	font-size: 2rem;
	font-weight: 700;
	color: var(--color-primary, #16a34a);
	display: block;
}

.reference-stat-label {
	font-size: 0.875rem;
	color: var(--color-text-muted, #6b7280);
	margin-top: 0.25rem;
	display: block;
}
