/*
	Enhancement layer — loaded after main.css on every page.
	1. Motion (page-load, scroll reveal, hovers)
	2. Home page (tiles, filters)
	3. Project page design system (.inner.project + components)
	4. Injected components (breadcrumb, chips, similar projects, back-to-top)
*/

:root {
	--accent: #f2849e;
	--accent-2: #8ea9f2;
	--accent-gradient: linear-gradient(90deg, #f2849e, #8ea9f2);
	--ink-muted: #999999;
	--line: #ececf1;
	--panel: #fafafb;
}

::selection {
	background: var(--accent);
	color: #ffffff;
}

html {
	scroll-behavior: smooth;
}

/* ---------- Page-load motion ---------- */

@keyframes fadeUp {
	from {
		opacity: 0;
		transform: translateY(22px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes underlineGrow {
	to {
		width: 4.5em;
	}
}

#main>.inner>header>h1,
#main>.inner>h1 {
	animation: fadeUp 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}

#main>.inner>header>p {
	animation: fadeUp 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s backwards;
}

/* Animated gradient underline beneath every page title */
#main>.inner>header>h1::after,
#main>.inner>h1::after {
	content: "";
	display: block;
	width: 0;
	height: 4px;
	margin-top: 0.3em;
	border-radius: 2px;
	background: var(--accent-gradient);
	animation: underlineGrow 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 0.35s forwards;
}

/* Logo tilt on hover */
#header .logo .symbol img {
	transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#header .logo:hover .symbol img {
	transform: rotate(12deg) scale(1.1);
}

/* ---------- Scroll reveal (elements get .reveal via JS) ---------- */

.reveal {
	opacity: 0;
	transform: translateY(26px);
	transition: opacity 0.7s cubic-bezier(0.22, 0.61, 0.36, 1),
		transform 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal.visible {
	opacity: 1;
	transform: none;
}

/* ---------- Home page tiles ---------- */

.tiles article {
	border-radius: 12px;
	overflow: hidden;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.tiles article:hover {
	transform: translateY(-8px);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

/* Filter fade-out state (JS toggles this before adding .hidden) */
.tiles article.fade-out {
	opacity: 0 !important;
	transform: scale(0.92) !important;
	transition-duration: 0.3s !important;
	transition-delay: 0s !important;
}

/* Filter buttons — horizontal padding only; Phantom centers text
   with a fixed height/line-height pair, so vertical padding skews it */
.filter-buttons button {
	padding: 0 1.4em !important;
	transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.filter-buttons button:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.filter-buttons button.active {
	background: var(--accent-gradient) !important;
}

/* ==========================================================
   Project page design system — pages opt in with
   <div class="inner project">
   ========================================================== */

.inner.project {
	max-width: 62em;
	font-size: 0.85em;
}

/* Intro line under the title */
.project .project-lede {
	font-size: 1.2em;
	line-height: 1.6;
	color: #777777;
	max-width: 38em;
	margin: 0 0 2em;
}

.project h2 {
	font-size: 1.35em;
	margin: 2.2em 0 0.8em;
}

.project h2::before {
	content: "";
	display: inline-block;
	width: 0.5em;
	height: 0.5em;
	margin-right: 0.6em;
	border-radius: 2px;
	background: var(--accent-gradient);
	transform: rotate(45deg) translateY(-0.05em);
}

/* Meta strip under the banner: Tools / Scope / Links */
.meta-bar {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13em, 1fr));
	gap: 1.5em 2.5em;
	padding: 1.6em 2em;
	margin: 0 0 2.5em;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: linear-gradient(180deg, #fafafb, #f4f4f8);
}

.meta-bar h3 {
	font-size: 0.7em;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--ink-muted);
	margin: 0 0 0.7em;
}

.meta-bar ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.meta-bar li {
	padding: 0;
	margin: 0 0 0.35em;
	line-height: 1.5;
}

.meta-bar a {
	font-weight: 600;
}

/* Media figure: image or video with optional caption */
.media {
	display: block;
	margin: 2em auto;
	max-width: 44em;
}

.media img,
.media video,
.media iframe {
	display: block;
	width: 100%;
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

.media figcaption {
	text-align: center;
	font-size: 0.85em;
	color: var(--ink-muted);
	margin-top: 0.9em;
}

.media.small {
	max-width: 30em;
}

/* Scrollable wrapper for the data table on the Remy page */
.table-wrap {
	max-height: 24rem;
	overflow: auto;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 1em 1.5em;
	margin: 2em auto;
	max-width: 44em;
}

/* Side-by-side text + media row */
.split {
	display: flex;
	align-items: center;
	gap: 2.5em;
	margin: 2.5em 0;
}

.split .split-media {
	flex: 1.2;
	min-width: 0;
}

.split .split-text {
	flex: 1;
	min-width: 0;
}

.split .split-media img,
.split .split-media video {
	display: block;
	width: 100%;
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
	margin-bottom: 0.8em;
}

.split .split-media img:last-child,
.split .split-media video:last-child {
	margin-bottom: 0;
}

.split .split-media figcaption {
	text-align: center;
	font-size: 0.85em;
	color: var(--ink-muted);
	margin-top: 0.9em;
}

.split.flip {
	flex-direction: row-reverse;
}

/* Two-up image grid */
.gallery-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1em;
	align-items: center;
	margin: 2em 0;
}

.gallery-2 img {
	display: block;
	width: 100%;
	border-radius: 12px;
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

/* Small centered note (e.g. example arguments) */
.callout {
	max-width: 26em;
	margin: 2em auto;
	padding: 1.3em 1.6em;
	text-align: center;
	background: var(--panel);
	border: 1px dashed #dddde5;
	border-radius: 12px;
}

.callout p {
	margin: 0 0 0.5em;
}

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

.callout code {
	background: rgba(242, 132, 158, 0.1);
	border-radius: 4px;
	padding: 0.15em 0.5em;
}

/* Call-to-action buttons at the end of a page */
.cta-row {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 1em;
	margin: 3em 0 1em;
}

.cta-row .button.primary {
	background: var(--accent-gradient);
	box-shadow: none;
	color: #ffffff !important;
}

.cta-row .button.primary:hover {
	filter: brightness(1.05);
}

/* Music page playlist */
.playlist {
	list-style: none;
	max-width: 30em;
	margin: 1.5em auto;
	padding: 0;
	text-align: left;
	border: 1px solid var(--line);
	border-radius: 12px;
	overflow: hidden;
}

.playlist li {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var(--line);
}

.playlist li:last-child {
	border-bottom: none;
}

.playlist li a {
	display: block;
	padding: 0.7em 1.2em;
	border-bottom: none !important;
	transition: background 0.2s ease, color 0.2s ease;
}

.playlist li a:hover {
	background: var(--panel);
	color: var(--accent);
}

.playlist li.active a {
	color: #c95d7a;
	font-weight: 600;
	background: rgba(242, 132, 158, 0.08);
}

.playlist-hint {
	text-align: center;
	font-size: 0.85em;
	color: var(--ink-muted);
	margin: 1em 0 0;
}

/* Banner image settles in on load */
#main .image.main img {
	border-radius: 14px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
	animation: bannerSettle 1.1s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}

@keyframes bannerSettle {
	from {
		opacity: 0;
		transform: scale(1.025);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* Legacy pages only: soften remaining inline-styled gray boxes */
#main div[style*="#e7e7e7"] {
	background: linear-gradient(180deg, #fafafb, #f1f1f5) !important;
	border: 1px solid #eaeaf0;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Responsive stacking */
@media screen and (max-width: 736px) {

	.split,
	.split.flip {
		flex-direction: column;
		gap: 1.5em;
	}

	.gallery-2 {
		grid-template-columns: 1fr;
	}
}

/* ---------- Injected: breadcrumb above project titles ---------- */

.project-breadcrumb {
	display: inline-block;
	margin-bottom: 1.2em;
	font-size: 0.75em;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	border-bottom: none !important;
	color: var(--ink-muted);
	transition: color 0.25s ease;
}

.project-breadcrumb .arrow {
	display: inline-block;
	transition: transform 0.25s ease;
}

.project-breadcrumb:hover {
	color: var(--accent);
}

.project-breadcrumb:hover .arrow {
	transform: translateX(-4px);
}

/* ---------- Injected: tag chips under project titles ---------- */

.project-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
	margin: -0.5em 0 1.5em;
}

.project-tags .chip {
	font-size: 0.65em;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	padding: 0.45em 1.1em;
	border-radius: 999px;
	color: #c95d7a;
	background: rgba(242, 132, 158, 0.1);
	border: 1px solid rgba(242, 132, 158, 0.35);
}

/* ---------- Injected: similar projects at the bottom of project pages ---------- */

.similar-projects {
	margin-top: 4em;
	padding-top: 1.5em;
	border-top: solid 1px var(--line);
}

.similar-projects h2 {
	margin-top: 1em;
}

.similar-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.8em;
}

a.similar-card {
	display: block;
	border: 1px solid var(--line);
	border-bottom: 1px solid var(--line) !important;
	border-radius: 12px;
	overflow: hidden;
	background: #ffffff;
	text-decoration: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

a.similar-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

a.similar-card .sc-thumb {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
}

a.similar-card .sc-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

a.similar-card .sc-body {
	display: block;
	padding: 1em 1.2em 1.1em;
}

a.similar-card .sc-title {
	display: block;
	font-weight: 700;
	line-height: 1.4;
	margin-bottom: 0.35em;
}

a.similar-card .sc-tags {
	display: block;
	font-size: 0.75em;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-muted);
}

@media screen and (max-width: 736px) {
	.similar-grid {
		grid-template-columns: 1fr;
	}
}

/* ---------- Back-to-top button ---------- */

.to-top {
	position: fixed;
	right: 1.5em;
	bottom: 1.5em;
	width: 3em;
	height: 3em;
	border: none;
	border-radius: 50%;
	background: var(--accent-gradient);
	color: #ffffff;
	font-size: 1em;
	line-height: 1;
	padding: 0;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translateY(12px);
	transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
	z-index: 10000;
}

.to-top.show {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

.to-top:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-delay: 0s !important;
		transition-duration: 0.01ms !important;
	}

	html {
		scroll-behavior: auto;
	}

	.reveal {
		opacity: 1 !important;
		transform: none !important;
	}
}
