/* Work detail page specific styles */
:root {
	/* These variables are kept here for backward compatibility */
	--text-color: var(--color-text-primary);
	--piece-image-aspect-ratio: 16/9;
	--grid-item-title-font-size: 18px;

	/* Work detail specific variables */
	--work-header-margin-bottom: 1rem;
	--work-description-line-height: 24px;
	--work-description-margin: 2rem;
	--work-back-button-icon-margin: 0.75rem;
	--work-title-padding: 0 2rem;
	--work-view-toggle-gap: 0;
	--work-list-view-padding: 2rem 0;
	--work-list-view-title-margin: 1rem;
	--work-list-view-image-padding: 2rem;

	/* Grid layout dimensions */
	--grid-gap: 1rem;
	--grid-max-height: 85vh;
	--grid-row-height-desktop: calc(40vh - 2rem);
	--grid-row-height-tablet: calc(30vh - 1rem);
	--grid-row-height-mobile: calc(25vh - 0.5rem);

	/* Etude grid cell dimensions */
	--etude-width: 400px;
	--etude-height: 300px;
	--empty-cell-width: 400px;

	/* Mobile dimensions */
	--etude-width-mobile: 250px;
	--etude-height-mobile: 225px;
	--empty-cell-width-mobile: 250px;

	/* Small mobile dimensions */
	--etude-small-mobile-width: 250px;
	--etude-small-mobile-height: 187.5px;

	/* UI elements */
	--view-toggle-size: 40px;
	--play-button-size: 60px;
	--play-button-size-mobile: 50px;
	--play-button-size-small-mobile: 45px;
	--etude-title-margin: 0.5rem;
	--etude-play-button-size: 24px;
	--etude-play-button-margin: 10px;

	/* Video modal */
	--video-modal-bg-color: rgba(0, 0, 0, 0.9);
	--video-modal-z-index: 1000;
	--video-modal-transition: opacity 0.3s ease;
}

.content-container {
	z-index: 12;
}

.timeline-view-wrapper {
	z-index: 12;
}

/* Work detail container */
.work-detail-container {
	margin: 0 auto;
	overflow-x: hidden;
}

/* Work detail header styles - full width */
.work-detail-header {
	width: 100%;
	position: relative;
	z-index: 12;
	padding: 1.5rem 3rem;
	margin-bottom: var(--work-header-margin-bottom);
}

.work-detail-header-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

/* Back button styles */
.back-button {
	display: flex;
	align-items: center;
	font-family: var(--font-primary);
	font-weight: var(--font-weight-medium);
	font-size: var(--font-size-normal);
	line-height: var(--line-height-normal);
	letter-spacing: 0px;
	color: var(--color-text-primary);
	text-decoration: none;
	transition: opacity 0.3s ease;
	padding: 0.5rem 0;
	z-index: 15;
}

.back-button i {
	margin-right: var(--work-back-button-icon-margin);
	font-size: 1.25rem;
}

.back-button:hover {
	opacity: 0.7;
}

/* Title styles */
.work-detail-title {
	font-family: var(--font-heading);
	font-weight: var(--font-weight-bold);
	font-size: var(--font-size-heading-large);
	line-height: var(--line-height-heading-large);
	letter-spacing: 0px;
	text-align: center;
	color: var(--color-text-primary);
	margin: 0;
	flex: 1;
	padding: var(--work-title-padding);
}

/* View toggle buttons */
.view-toggle-container {
	display: flex;
	z-index: 15;
	gap: var(--work-view-toggle-gap);
}

.view-toggle-btn {
	width: var(--view-toggle-size);
	height: var(--view-toggle-size);
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: transparent;
	border: 1px solid var(--color-text-primary);
	color: var(--color-text-primary);
	cursor: pointer;
	transition: all 0.3s ease;
}

.view-toggle-btn.active {
	background-color: var(--color-text-primary);
	color: #ffffff;
}

.view-toggle-btn:hover:not(.active) {
	background-color: rgba(23, 26, 31, 0.05);
}

/* Work description */
.work-description {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-normal);
	font-size: var(--font-size-normal);
	line-height: var(--work-description-line-height);
	color: var(--color-text-primary);
	text-align: center;
	margin-bottom: var(--work-description-margin);
	margin-left: auto;
	margin-right: auto;
}

/* View containers */
.view-container {
	width: 100%;
}

.view-container.hidden {
	display: none;
}

/* List view styles */
.list-view {
	display: flex;
	flex-direction: column;
	padding: var(--work-list-view-padding);
}

.listView-item {
	display: flex;
	flex-direction: row;
	align-items: center;
	padding: var(--work-list-view-padding);
	cursor: pointer;
	transition: all 0.3s ease;
}

.listView-item-image {
	width: 50%;
	position: relative;
	padding-right: var(--work-list-view-image-padding);
}

.listView-item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(100%);
	transition: all 0.3s ease;
}

.listView-item-image:hover img {
	filter: none;
}

.listView-item-content {
	width: 50%;
	padding-left: var(--work-list-view-image-padding);
}

.listView-item-title {
	font-family: var(--font-heading);
	font-weight: var(--font-weight-bold);
	font-size: var(--font-size-social-title);
	line-height: var(--line-height-social-title);
	margin-bottom: var(--work-list-view-title-margin);
	color: var(--color-text-primary);
}

.listView-item-description {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-normal);
	color: var(--color-text-primary);
	font-size: var(--font-size-normal);
	line-height: var(--line-height-normal);
	letter-spacing: 0px;
}

.play-button {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: var(--play-button-size);
	height: var(--play-button-size);
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 0.3s ease;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.listView-item:hover .play-button {
	opacity: 1;
}

.play-button i {
	color: #000;
	font-size: 22px;
	margin-left: 4px;
}

/* Timeline view styles - matching intro screen */
.timeline-view {
	width: 100%;
	overflow-x: auto;
	padding-left: 3rem;
	padding-bottom: 2rem;
	position: relative;
	z-index: 12;
	overflow-y: hidden;
	/* Prevent vertical scrolling */
}

/* Hide scrollbar but allow scrolling */
.timeline-view::-webkit-scrollbar {
	display: none;
}

.timeline-view {
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.grid-layout {
	display: grid;
	grid-template-rows: repeat(2, var(--grid-row-height-desktop));
	gap: var(--grid-gap);
	width: max-content;
	position: relative;
	max-height: var(--grid-max-height);
}

/* Grid cells */
.grid-cell {
	position: relative;
	scroll-snap-align: start;
	max-height: 100%;
}

.etude-cell {
	width: var(--etude-width);
	min-width: var(--etude-width);
	height: var(--etude-height);
	min-height: var(--etude-height);
	padding: 0;
	border: none;
	background-color: transparent;
}

/* Empty cells for spacing */
.empty-cell-odd,
.empty-cell-even {
	width: var(--empty-cell-width);
	min-width: var(--empty-cell-width);
	border: none;
}

/* Etude content styles - exactly match intro screen */
.etude-content {
	height: 100%;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: all 0.3s ease;
	cursor: pointer;
	padding: 0;
	margin: 0;
}

.etude-title {
	font-family: var(--font-primary);
	font-weight: var(--font-weight-normal);
	font-size: var(--font-size-heading-medium);
	line-height: var(--line-height-heading-medium);
	letter-spacing: 0px;
	margin-bottom: var(--etude-title-margin);
	color: var(--color-text-primary);
	transition: font-weight 0.3s ease;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.etude-title-text {
	flex: 1;
}

.etude-play-button {
	display: none;
	width: var(--etude-play-button-size);
	height: var(--etude-play-button-size);
	border-radius: 50%;
	background-color: rgba(255, 255, 255, 0.8);
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin-left: var(--etude-play-button-margin);
}

.etude-play-button i {
	color: #000;
	font-size: 10px;
	margin-left: 2px;
}

.etude-image-container {
	flex-grow: 1;
	position: relative;
	overflow: hidden;
	min-height: 150px;
}

.etude-image {
	width: 100%;
	max-width: 500px;
	height: auto;
	aspect-ratio: var(--piece-image-aspect-ratio);
	object-fit: cover;
	filter: grayscale(100%);
	transition: all 0.3s ease;
}

/* Hover effects - exactly match intro screen */
.etude-content:hover .etude-image {
	filter: none;
	transform: translateY(1px);
}

.etude-content:hover .etude-title {
	font-weight: var(--font-weight-bold);
}

.etude-content:hover .etude-play-button {
	display: flex;
}

/* Helper classes */
.hidden {
	display: none;
}

/* Add styles for the video player modal */
.video-player-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--video-modal-bg-color);
	z-index: var(--video-modal-z-index);
	display: none;
	justify-content: center;
	align-items: center;
	opacity: 0;
	transition: var(--video-modal-transition);
}

.video-player-modal.active {
	display: flex;
	opacity: 1;
}

/* Make sure the video player container has appropriate size in the modal */
.video-player-modal .video-player-container {
	width: 100%;
	height: auto;
	max-height: 100vh;
}

/* Media queries for responsive design */
@media (max-width: 768px) {
	.work-detail-header-container {
		flex-direction: column;
		align-items: flex-start;
		gap: 1.5rem;
		padding: 0 1.25rem;
	}

	.work-detail-title {
		font-size: 28px;
		line-height: 1.3;
		max-width: 100%;
		text-align: center;
		margin: 0;
		padding: 0;
	}

	.view-toggle-container {
		align-self: center;
	}

	.work-description {
		text-align: center;
		margin-bottom: var(--work-description-margin);
	}

	.listView-item {
		flex-direction: column;
		align-items: flex-start;
		padding: 1.5rem 0;
	}

	.listView-item-image {
		width: 100%;
		height: auto;
		margin: 0 auto;
		margin-bottom: 0rem;
		padding: 0;
		order: 2;
	}

	.listView-item-content {
		order: 1;
		width: 100%;
		padding: 0;
		text-align: left;
		margin-bottom: 1rem;
	}

	.listView-item-title {
		font-size: 22px;
		margin-bottom: 0.75rem;
	}

	.listView-item-description {
		font-size: var(--font-size-normal);
		max-width: 100%;
	}

	.play-button {
		opacity: 0.8;
		width: var(--play-button-size-mobile);
		height: var(--play-button-size-mobile);
	}

	/* Timeline view mobile styles */
	.timeline-view {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		padding: 0 1.25rem;
	}

	.grid-layout {
		display: grid;
		grid-template-rows: repeat(2, var(--grid-row-height-tablet));
		gap: var(--grid-gap);
		width: max-content;
	}

	/* Grid cell specific styles for mobile */
	.etude-cell {
		width: var(--etude-width-mobile);
		min-width: var(--etude-width-mobile);
		height: var(--etude-height-mobile);
		min-height: var(--etude-height-mobile);
	}

	.empty-cell-odd,
	.empty-cell-even {
		width: var(--empty-cell-width-mobile);
		min-width: var(--empty-cell-width-mobile);
	}

	.etude-title {
		font-size: var(--font-size-normal);
		margin-bottom: 0.75rem;
	}
}

@media (max-width: 425px) {
	.work-detail-container {
		padding: 1rem 0;
	}

	.work-detail-header {
		margin-bottom: 0rem;
		padding: 1rem 0;
	}

	.back-button {
		font-size: 14px;
	}

	.work-detail-title {
		font-size: 24px;
	}

	.work-description {
		font-size: 14px;
		margin-bottom: 1.5rem;
	}

	/* Timeline view for small mobile */
	.timeline-view {
		padding: 0 1.25rem;
	}

	.grid-layout {
		display: grid;
		grid-template-rows: repeat(2, var(--grid-row-height-mobile));
		gap: var(--grid-gap);
	}

	.etude-cell {
		width: var(--etude-small-mobile-width);
		min-width: var(--etude-small-mobile-width);
		height: var(--etude-small-mobile-height);
		min-height: var(--etude-small-mobile-height);
	}

	.empty-cell-odd,
	.empty-cell-even {
		width: calc(var(--etude-small-mobile-width) * 0.5);
		min-width: calc(var(--etude-small-mobile-width) * 0.5);
	}

	.etude-title {
		font-size: 14px;
		margin-bottom: var(--etude-title-margin);
	}

	/* Show exactly 2 full etudes and half of a third one on small mobile */
	.grid-layout {
		width: calc(
			2.5 * var(--etude-small-mobile-width) +
				var(--etude-small-mobile-width) * 0.5
		);
	}

	.listView-item-title {
		font-size: 20px;
	}

	.listView-item-description {
		font-size: 14px;
	}

	.play-button {
		width: var(--play-button-size-small-mobile);
		height: var(--play-button-size-small-mobile);
	}

	.play-button i {
		font-size: 18px;
	}
}

/* Screen sizes between 426px and 768px */
@media (min-width: 426px) and (max-width: 768px) {
	.grid-layout {
		width: fit-content;
	}

	.etude-cell {
		width: var(--etude-width-mobile);
		min-width: var(--etude-width-mobile);
		height: var(--etude-height-mobile);
		min-height: var(--etude-height-mobile);
	}

	.empty-cell-odd,
	.empty-cell-even {
		width: var(--empty-cell-width-mobile);
		min-width: var(--empty-cell-width-mobile);
	}
}

@media (min-width: 769px) {
	.timeline-view-wrapper.full-width {
		width: 100vw;
		max-width: 100vw;
		margin-left: calc(-50vw + 50%);
		position: relative;
		left: 0;
		right: 0;
	}
}
