@import url("https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;600;700;800&display=swap");

/* Position warning box */
.warning {
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	right: 1rem;
	width: max-content;
	text-align: center;
	max-width: 90vw;
	margin: auto;
	z-index: 100;
	color: #111;
}

@layer demo {
	:root {
		scroll-behavior: smooth;

		--bg-page: #ffffff;
		--bg-card: #ffffff;
		--bg-subtle: #f6f8fa;
		--border-subtle: #d0d7de;
		--border-muted: #eaeef2;
		--text-primary: #1f2328;
		--text-secondary: #424a53;
		--text-muted: #656d76;

		/* Milestone accent colors */
		--color-apple: var(--color-csswg);
		--color-wicg: #2eb3c4;
		--color-firefox-early: #ea580c;
		--color-csswg: rebeccapurple;
		--color-proto: #0d9488;
		--color-rewrite: rebeccapurple;
		--color-chrome: #1a73e8;
		--color-edge: #008a69;
		--color-course: #dc2626;
		--color-safari: #0284c7;
		--color-firefox: #ea580c;
		--color-baseline: #2563eb;
		--color-baseline-check: #16a34a;

		/* Base 1-year vertical spacing unit on the timeline */
		--year-gap: 4rem;
	}

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

	html,
	body {
		margin: 0;
		padding: 0;
		background-color: var(--bg-page);
		color: var(--text-primary);
		font-family: "Google Sans", "Google Sans Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
		overflow-x: clip;
		-webkit-font-smoothing: antialiased;
	}

	/* Top scroll progress bar */
	.scroll-progress-bar {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		height: 3px;
		background: linear-gradient(
			90deg,
			var(--color-csswg) 0%,
			var(--color-csswg) 14%,
			var(--color-wicg) 23%,
			var(--color-firefox-early) 31%,
			var(--color-csswg) 41%,
			var(--color-proto) 48%,
			var(--color-rewrite) 58%,
			var(--color-chrome) 67%,
			var(--color-edge) 67%,
			var(--color-course) 74%,
			var(--color-safari) 82%,
			var(--color-firefox) 89%,
			var(--color-firefox) 100%
		);
		clip-path: inset(0 100% 0 0);
		z-index: 60;
	}

	/* Full-Width Sticky Header Bar (Text Only, Primer Brand style) */
	.sticky-header {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		width: 100%;
		z-index: 40;
		background: rgba(255, 255, 255, 0.92);
		backdrop-filter: blur(12px);
		border-bottom: 1px solid var(--border-subtle);
	}

	.sticky-header__inner {
		max-width: 76rem;
		margin: 0 auto;
		padding: 0 1.5rem;
		height: 3.5rem;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1.5rem;
	}

	.sticky-header__brand {
		display: inline-flex;
		align-items: center;
		gap: 0.5rem;
		flex-shrink: 0;
		font-size: 0.95rem;
		font-weight: 700;
		letter-spacing: -0.02em;
		color: var(--text-primary);
		text-decoration: none;
		white-space: nowrap;
	}

	.sticky-header__brand img {
		width: 24px;
		height: 24px;
		display: block;
	}

	.timeline-nav {
		display: flex;
		align-items: center;
		align-self: stretch;
		gap: 0.25rem;
		overflow-x: auto;
		scrollbar-width: none;
		scroll-snap-type: x mandatory;
		position: relative;
	}

	.sticky-header:hover .timeline-nav {
		scroll-snap-type: none;
	}

	.timeline-nav::-webkit-scrollbar {
		display: none;
	}

	.timeline-nav::before,
	.timeline-nav::after {
		content: '';
		display: block;
		position: sticky;
		top: 0;
		bottom: 0;
		width: 0.75rem;
		align-self: stretch;
		flex: 0 0 0.75rem;
		pointer-events: none;
		z-index: 2;
		visibility: hidden;
	}

	.timeline-nav::before {
		left: 0;
		margin-right: -1rem;
		background: radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / 0.25), rgb(0 0 0 / 0));
	}

	.timeline-nav::after {
		right: 0;
		margin-left: -1rem;
		background: radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / 0.25), rgb(0 0 0 / 0));
	}

	.timeline-pill {
		display: inline-flex;
		align-items: center;
		padding: 0.35rem 0.65rem;
		border-radius: 0.375rem;
		font-size: 0.82rem;
		font-weight: 500;
		letter-spacing: -0.01em;
		color: var(--text-muted);
		text-decoration: none;
		white-space: nowrap;
		transition: color 0.15s ease, background-color 0.15s ease;
	}

	.timeline-pill:hover,
	.timeline-pill:focus-visible {
		color: var(--text-primary);
		background: var(--bg-subtle);
	}

	/* Page Wrapper */
	.timeline-page {
		position: relative;
		width: 100%;
		margin: 0 auto;
	}

	/* Hero Intro Header — Full Viewport (100svh) */
	.hero-intro {
		min-height: 100svh;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		max-width: 56rem;
		margin: 0 auto;
		padding: 5rem 1.5rem 3rem;
	}

	.hero-intro__eyebrow {
		display: inline-block;
		font-size: 0.875rem;
		font-weight: 600;
		letter-spacing: -0.01em;
		color: var(--color-baseline);
		margin-bottom: 1rem;
	}

	.hero-intro__title {
		margin: 0 0 1.25rem;
		font-size: clamp(2.5rem, 6vw, 4.5rem);
		font-weight: 700;
		letter-spacing: -0.035em;
		line-height: 1.06;
		color: var(--text-primary);
	}

	.hero-intro__title span {
		display: block;
		color: var(--color-baseline);
	}

	.hero-intro__lead {
		margin: 0 auto;
		font-size: clamp(1.1rem, 2vw, 1.35rem);
		font-weight: 400;
		line-height: 1.5;
		letter-spacing: -0.01em;
		color: var(--text-secondary);
		max-width: 46ch;
	}

	/* Main Scrolled Timeline Section */
	.timeline-section {
		position: relative;
		max-width: 68rem;
		margin: 0 auto;
		padding: 2rem 1.5rem 0;
	}

	/* Central Vertical Spine Track */
	.timeline-spine {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 50%;
		width: 4px;
		translate: -50% 0;
		background: #e2e8f0;
		border-radius: 999px;
		overflow: hidden;
		z-index: 1;
	}

	.timeline-spine__fill {
		width: 100%;
		height: 100%;
		background: linear-gradient(
			180deg,
			var(--color-csswg) 0%,
			var(--color-csswg) 5%,
			var(--color-wicg) 17%,
			var(--color-firefox-early) 26%,
			var(--color-csswg) 39%,
			var(--color-proto) 48%,
			var(--color-rewrite) 60%,
			var(--color-chrome) 71%,
			var(--color-edge) 71%,
			var(--color-course) 80%,
			var(--color-safari) 89%,
			var(--color-firefox) 97%,
			var(--color-firefox) 100%
		);
		clip-path: inset(0 0 100% 0);
	}

	/* Timeline Events List — Gaps correspond proportionally to elapsed years */
	.timeline-list {
		list-style: none;
		margin: 0;
		padding: 0;
		display: grid;
		grid-template-columns: 1fr;
		gap: 0;
		position: relative;
		z-index: 2;
	}

	/* Individual Timeline Milestone Row */
	.timeline-item {
		position: relative;
		grid-column: 1;
		display: grid;
		grid-template-columns: 1fr 3.5rem 1fr;
		align-items: center;
		margin-top: calc(var(--years, 0) * var(--year-gap));
		scroll-margin-top: 25vh;
		pointer-events: none;
	}

	#milestone-2014,
	.timeline-item--safari-early,
	.timeline-item--apple {
		--accent: var(--color-csswg);
		--years: 0;
	}
	.timeline-item--wicg {
		/* Sep 2014 -> Sep 2016 = 2 years */
		--accent: var(--color-wicg);
		--years: 2;
	}
	.timeline-item--firefox-early {
		/* Sep 2016 -> Dec 2016 = 0.25 years (3 months) */
		--accent: var(--color-firefox-early);
		--years: 0.25;
	}
	.timeline-item--csswg {
		/* Dec 2016 -> 2019 = 2.5 years */
		--accent: var(--color-csswg);
		--years: 2.5;
	}
	.timeline-item--proto {
		/* 2019 -> 2020 = 1 year (1x the 1-year gap) */
		--accent: var(--color-proto);
		--years: 1;
	}
	.timeline-item--rewrite {
		/* 2020 -> 2022 = 2 years (2x the 1-year gap) */
		--accent: var(--color-rewrite);
		--years: 2;
	}
	.timeline-item--chrome {
		/* 2022 -> July 2023 = 1.5 years */
		--accent: var(--color-chrome);
		--years: 1.5;
		grid-row: 7;
	}
	.timeline-item--edge {
		/* Chrome 115 & Edge 115 shipped simultaneously in July 2023 -> 0 gap! */
		--accent: var(--color-edge);
		--years: 1.5;
		grid-row: 7;
	}
	.timeline-item--course {
		/* July 2023 -> May 2024 = 0.83 years (10 months) */
		--accent: var(--color-course);
		--years: 0.83;
	}
	.timeline-item--safari {
		/* May 2024 -> Sept 2025 = 1.33 years (16 months) */
		--accent: var(--color-safari);
		--years: 1.33;
	}
	.timeline-item--firefox {
		/* Sept 2025 -> Oct 2026 = 1.08 years */
		--accent: var(--color-firefox);
		--years: 1.08;
	}

	/* Odd items on the left, even items on the right */
	.timeline-item:nth-child(odd) .timeline-card-wrap {
		grid-column: 1;
		justify-self: end;
		padding-right: 1.5rem;
		--slide-x: -36px;
	}

	.timeline-item:nth-child(even) .timeline-card-wrap {
		grid-column: 3;
		justify-self: start;
		padding-left: 1.5rem;
		--slide-x: 36px;
	}

	/* Central Node (Dot) on the Spine */
	.timeline-node {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
		width: 2.25rem;
		height: 2.25rem;
		border-radius: 50%;
		background: #ffffff;
		border: 3px solid var(--accent);
		box-shadow:
			0 0 0 5px #ffffff,
			0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
		display: grid;
		place-items: center;
		z-index: 3;
		pointer-events: auto;
		will-change: transform, filter, opacity;
	}

	.timeline-item--edge .timeline-node {
		border-color: var(--color-chrome) var(--color-edge) var(--color-edge) var(--color-chrome);
	}

	.timeline-node__dot {
		width: 0.65rem;
		height: 0.65rem;
		border-radius: 50%;
		background: var(--accent);
	}

	.timeline-item--edge .timeline-node__dot {
		background: linear-gradient(90deg, var(--color-chrome) 50%, var(--color-edge) 50%);
	}

	/* Horizontal Connector Arm from Spine to Card */
	.timeline-connector {
		position: absolute;
		top: 50%;
		height: 2px;
		width: 1.5rem;
		background: var(--accent);
		translate: 0 -50%;
	}

	.timeline-item:nth-child(odd) .timeline-connector {
		right: 0;
		transform-origin: right center;
	}

	.timeline-item:nth-child(even) .timeline-connector {
		left: 0;
		transform-origin: left center;
	}

	/* Card Wrapper & Card */
	.timeline-card-wrap {
		position: relative;
		grid-row: 1;
		width: 100%;
		max-width: 27rem;
		pointer-events: auto;
	}

	.timeline-card {
		position: relative;
		background: var(--bg-card);
		border: 1px solid var(--border-subtle);
		border-top: 3px solid var(--accent);
		border-radius: 0.875rem;
		padding: 1.25rem 1.35rem;
		box-shadow:
			0 8px 24px rgba(140, 149, 159, 0.15),
			0 1px 3px rgba(31, 35, 40, 0.06);
		display: flex;
		flex-direction: column;
		gap: 0.55rem;
		will-change: transform, opacity, filter;
	}

	.timeline-card__header {
		display: flex;
		align-items: center;
		gap: 0.75rem;
	}

	.timeline-card__icons {
		display: flex;
		align-items: center;
		gap: 0.45rem;
		flex-shrink: 0;
	}

	.timeline-card__icon {
		width: 2.65rem;
		height: 2.65rem;
		flex-shrink: 0;
		display: grid;
		place-items: center;
		border-radius: 0.65rem;
		background: var(--bg-subtle);
		border: 1px solid var(--border-muted);
		padding: 0.35rem;
	}

	.timeline-card__icon svg,
	.timeline-card__icon img {
		width: 100%;
		height: 100%;
		display: block;
	}

	.timeline-card__meta {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 0.45rem;
	}

	.timeline-card__date {
		display: inline-block;
		font-size: 0.75rem;
		font-weight: 700;
		letter-spacing: 0.03em;
		text-transform: uppercase;
		padding: 0.18rem 0.55rem;
		border-radius: 999px;
		background: color-mix(in srgb, var(--accent) 12%, #ffffff);
		border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
		color: var(--accent);
	}

	.timeline-card__tag {
		font-size: 0.75rem;
		font-weight: 500;
		color: var(--text-muted);
	}

	.timeline-card__title {
		margin: 0;
		font-size: 1.125rem;
		font-weight: 700;
		letter-spacing: -0.02em;
		line-height: 1.3;
		color: var(--text-primary);
	}

	.timeline-card__title code,
	.timeline-card__desc code {
		font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
		font-size: 0.86em;
		padding: 0.12em 0.38em;
		border-radius: 0.35rem;
		background: var(--bg-subtle);
		border: 1px solid var(--border-muted);
		color: var(--text-primary);
	}

	.timeline-card__desc {
		margin: 0;
		font-size: 0.9rem;
		line-height: 1.5;
		color: var(--text-secondary);
	}

	.timeline-card__link {
		display: inline-flex;
		align-items: center;
		gap: 0.3rem;
		align-self: flex-start;
		margin-top: 0.2rem;
		font-size: 0.8rem;
		font-weight: 600;
		color: #0969da;
		text-decoration: none;
		padding: 0.25rem 0.6rem;
		border-radius: 0.45rem;
		background: #f0f6fc;
		border: 1px solid rgba(9, 105, 218, 0.25);
		transition: background 0.15s ease, border-color 0.15s ease;
	}

	.timeline-card__links {
		display: flex;
		flex-wrap: wrap;
		gap: 0.5rem;
		align-items: center;
	}

	.timeline-card__link:hover,
	.timeline-card__link:focus-visible {
		background: #ddf4ff;
		border-color: rgba(9, 105, 218, 0.5);
	}

	/* Baseline Newly Available Climax Finale — Full Viewport (100svh) & Centered */
	.baseline-finale {
		position: relative;
		min-height: 100svh;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 4.5rem 1.5rem 2.5rem;
		z-index: 5;
	}

	.baseline-finale__node {
		display: none !important;
		width: 3rem;
		height: 3rem;
		border-radius: 50%;
		background: var(--color-baseline);
		border: 4px solid #ffffff;
		box-shadow:
			0 0 0 2px rgba(37, 99, 235, 0.3),
			0 8px 24px rgba(37, 99, 235, 0.3);
		display: grid;
		place-items: center;
		color: #ffffff;
		font-size: 1.15rem;
		font-weight: 800;
		margin-bottom: 1.25rem;
		z-index: 6;
	}

	.baseline-hero {
		position: relative;
		width: 100%;
		max-width: 42rem;
		border-radius: 1.5rem;
		background:
			radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08), transparent 65%),
			#ffffff;
		border: 1.5px solid var(--border-subtle);
		box-shadow:
			0 20px 50px rgba(31, 35, 40, 0.12),
			0 4px 12px rgba(31, 35, 40, 0.06);
		padding: 2.25rem 2rem 1.85rem;
		text-align: center;
		display: flex;
		flex-direction: column;
		align-items: center;
		will-change: transform, opacity;
	}

	.baseline-hero__pill {
		display: inline-flex;
		align-items: center;
		gap: 0.4rem;
		padding: 0.3rem 0.85rem;
		border-radius: 999px;
		background: #eff6ff;
		border: 1px solid rgba(37, 99, 235, 0.3);
		color: var(--color-baseline);
		font-size: 0.78rem;
		font-weight: 700;
		letter-spacing: 0.04em;
		text-transform: uppercase;
		margin-bottom: 1.1rem;
	}

	.baseline-logo-wrap {
		width: 8.5rem;
		height: 4.75rem;
		margin-bottom: 0.9rem;
		display: grid;
		place-items: center;
	}

	.baseline-logo-svg {
		width: 100%;
		height: 100%;
		overflow: visible;
		filter: drop-shadow(0 6px 16px rgba(37, 99, 235, 0.22));
	}

	.baseline-logo-check {
		fill: #2563eb;
		transform-origin: 14px 10px;
		will-change: transform, opacity;
	}

	.baseline-logo-diamond {
		fill: #60a5fa;
		transform-box: fill-box;
		transform-origin: center;
		will-change: transform, opacity;
	}

	.baseline-hero__heading {
		margin: 0 0 0.5rem;
		font-size: clamp(1.75rem, 3.5vw, 2.35rem);
		font-weight: 700;
		letter-spacing: -0.03em;
		color: var(--text-primary);
	}

	.baseline-hero__heading strong {
		color: var(--color-baseline);
	}

	.baseline-hero__desc {
		margin: 0 0 1.5rem;
		font-size: 1rem;
		color: var(--text-secondary);
		max-width: 44ch;
		line-height: 1.5;
	}

	/* Converged 4 Browser Badges inside Baseline Hero Card */
	.baseline-browsers {
		width: 100%;
		display: grid;
		grid-template-columns: repeat(4, 1fr);
		gap: 0.75rem;
		padding: 0.9rem;
		border-radius: 1rem;
		background: var(--bg-subtle);
		border: 1px solid var(--border-muted);
	}

	.baseline-browser-badge {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.3rem;
		padding: 0.75rem 0.4rem;
		border-radius: 0.75rem;
		background: #ffffff;
		border: 1px solid var(--border-subtle);
		box-shadow: 0 2px 6px rgba(31, 35, 40, 0.04);
	}

	.baseline-browser-badge svg,
	.baseline-browser-badge img {
		width: 2.35rem;
		height: 2.35rem;
		display: block;
	}

	.baseline-browser-badge__name {
		font-size: 0.8rem;
		font-weight: 700;
		color: var(--text-primary);
		white-space: nowrap;
	}

	.baseline-browser-badge__date {
		font-size: 0.7rem;
		font-weight: 500;
		color: var(--text-muted);
		white-space: nowrap;
	}

	.baseline-browser-badge__check {
		position: absolute;
		top: -6px;
		right: -6px;
		width: 1.25rem;
		height: 1.25rem;
		border-radius: 50%;
		background: #16a34a;
		border: 2px solid #ffffff;
		color: #ffffff;
		font-size: 0.68rem;
		font-weight: 800;
		display: grid;
		place-items: center;
		box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
	}

	.baseline-finale__cta {
		margin-top: 1.5rem;
		font-size: 0.9rem;
		font-weight: 500;
		color: var(--text-secondary);
		text-decoration: underline;
		text-underline-offset: 0.22em;
		transition: color 0.15s ease;
	}

	.baseline-finale__cta:hover,
	.baseline-finale__cta:focus-visible {
		color: var(--color-baseline);
	}

	/* Compact adjustments for smaller viewports (including 512x512 square preview) */
	@media (max-width: 400px) {
		.sticky-header {
			display: none;
		}
	}

	@media (max-width: 640px) {
		:root {
			--year-gap: 2.5rem;
		}

		.sticky-header__brand span {
			display: none;
		}

		.timeline-section {
			padding: 1rem 1.25rem 0;
		}

		.timeline-item {
			grid-template-columns: 1fr 2.2rem 1fr;
		}

		.timeline-node {
			width: 1.75rem;
			height: 1.75rem;
		}

		.timeline-item:nth-child(odd) .timeline-card-wrap {
			padding-right: 0.75rem;
			--slide-x: -20px;
		}

		.timeline-item:nth-child(even) .timeline-card-wrap {
			padding-left: 0.75rem;
			--slide-x: 20px;
		}

		.timeline-connector {
			width: 0.75rem;
		}

		.timeline-card {
			padding: 0.95rem 1.05rem;
			border-radius: 0.75rem;
			gap: 0.45rem;
		}

		.timeline-card__header {
			gap: 0.6rem;
		}

		.timeline-card__icons {
			gap: 0.35rem;
		}

		.timeline-card__icon {
			width: 2.2rem;
			height: 2.2rem;
			padding: 0.28rem;
			border-radius: 0.5rem;
		}

		.timeline-card__date {
			font-size: 0.72rem;
			padding: 0.14rem 0.48rem;
		}

		.timeline-card__tag {
			display: none;
		}

		.timeline-card__title {
			font-size: 1rem;
		}

		.timeline-card__desc {
			font-size: 0.85rem;
			line-height: 1.45;
		}

		.timeline-card__link {
			font-size: 0.76rem;
			padding: 0.22rem 0.52rem;
		}

		.baseline-finale {
			padding: 3rem 1.25rem 1.5rem;
		}

		.baseline-finale__node {
			width: 2.25rem;
			height: 2.25rem;
			font-size: 0.9rem;
			margin-bottom: 0.75rem;
		}

		.baseline-hero {
			padding: 1.35rem 1.15rem 1.15rem;
		}

		.baseline-logo-wrap {
			width: 6rem;
			height: 3.3rem;
			margin-bottom: 0.5rem;
		}

		.baseline-hero__desc {
			font-size: 0.88rem;
			margin-bottom: 1rem;
		}

		.baseline-browsers {
			gap: 0.5rem;
			padding: 0.6rem;
		}

		.baseline-browser-badge {
			padding: 0.5rem 0.3rem;
		}

		.baseline-browser-badge svg,
		.baseline-browser-badge img {
			width: 1.85rem;
			height: 1.85rem;
		}

		.baseline-browser-badge__name {
			font-size: 0.75rem;
		}

		.baseline-browser-badge__date {
			font-size: 0.65rem;
		}

		.baseline-finale__cta {
			margin-top: 0.85rem;
			font-size: 0.8rem;
		}
	}

	/* Single-column layout for very narrow phone screens */
	@media (max-width: 440px) {
		.timeline-section {
			padding: 1rem 1.5rem 0 1rem;
		}

		.timeline-spine {
			left: 2.125rem;
		}

		.timeline-item {
			grid-template-columns: 2.25rem 1fr;
		}

		.timeline-item--chrome,
		.timeline-item--edge {
			grid-row: auto;
		}

		.timeline-item--edge {
			--years: 0;
		}

		.timeline-node {
			grid-column: 1;
		}

		.timeline-item:nth-child(odd) .timeline-card-wrap,
		.timeline-item:nth-child(even) .timeline-card-wrap {
			grid-column: 2;
			justify-self: stretch;
			padding-left: 1rem;
			padding-right: 0;
			--slide-x: 20px;
		}

		.timeline-item:nth-child(odd) .timeline-connector,
		.timeline-item:nth-child(even) .timeline-connector {
			left: 0;
			right: auto;
			width: 1rem;
			transform-origin: left center;
		}

		.baseline-browsers {
			grid-template-columns: repeat(2, 1fr);
		}
	}
}
