/*--------------------------------------------------------------
>>> SIDEBAR
----------------------------------------------------------------
# Related videos
# Hide thumbnails
# Livechat
# Hide playlist
# Hide Related videos
# Move sidebar left
# Move thumbnails right

--------------------------------------------------------------*/
/*--------------------------------------------------------------
# SIDEBAR AUTO SIZING
--------------------------------------------------------------*/
html[it-hide-sidebar='true'] ytd-watch-flexy[flexy] #secondary.ytd-watch-flexy {
	width: auto !important;
	min-width: unset !important;
}

html[it-hide-sidebar='true'] ytd-watch-flexy[flexy] #primary.ytd-watch-flexy {
	max-width: calc(100vw - (var(--ytd-margin-6x)*2)) !important;
	width: fit-content;
	min-width: unset !important;
}

html[it-hide-sidebar='true'] ytd-watch-flexy[flexy] #secondary{
	container-name: sidebar;
	container-type: inline-size;
}

html[it-hide-sidebar='true'] ytd-live-chat-frame,
div#secondary div#related,
div#secondary div#panels,
div#secondary div#donation-shelf,
div#secondary #playlist {
	max-width: var(--ytd-watch-flexy-sidebar-width);
	min-width: unset !important;
}
/*--------------------------------------------------------------
# TRANSCRIPT
--------------------------------------------------------------*/
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'], 
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript']  ytd-engagement-panel-section-list-renderer #content {
	max-height: 77vh !important;
}
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'] #title {
	opacity: 0.4;
}

html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']  ytd-watch-flexy:not([fullscreen]) #columns {
	display:flex !important;
	max-width:99% !important;
} 
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript'], 
html[data-page-type=video][it-transcript='true'] *[target-id*='transcript']:not([it-sidebar-left='true']) ytd-engagement-panel-section-list-renderer #content {
	min-width: max(445px,17vw) !important;
	max-width: min(24vw,650px) !important;
	margin-left: -20px !important;
} 
html[data-page-type=video][it-transcript='true']:not([it-player-size='1080p']):not([it-player-size='1440p']):not([it-player-size='2160p']):not([it-player-size='custom']):not([it-player-size='max_width']) ytd-watch-flexy:not([fullscreen]) #player {
	max-width: 1280px !important;
}

@media screen and  (min-width: 1599px) {	
html[data-page-type=video][it-transcript='true']  ytd-watch-flexy:not([fullscreen]) #secondary {
	display:flex !important;
 max-width: 99% !important;
} 
html[data-page-type=video][it-transcript='true'] ytd-browse > ytd-two-column-browse-results-renderer {
	object-fit: contain !important;
	max-width: 99% !important;
	margin: -5px;
}
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true'] *[target-id*='transcript'],
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) *[target-id*='transcript'] {
	min-width: 440px !important;
	max-width:440px !important;
	object-fit: contain !important;
	overflow-x: hidden !important;
	float: right;  /* direction: rtl; */
}
/*
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) td-engagement-panel-section-list-renderer {
	text-align: right !important;
	direction: ltr;
}
*/
/* caused #cinematics to get a higher z-index:
html[data-page-type=video][it-transcript='true'][it-sidebar-left='true']:not([it-player-size='max_width']) #player {
	z-index:1000 !important;
	left:-10px !important;
}
*/
}

html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer:hover { overflow-x: visible !important; }
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer:has(+ ytd-transcript-segment-renderer.active) yt-formatted-string 
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.26em !important;} 
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active yt-formatted-string 
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.35em !important;}		
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active + ytd-transcript-segment-renderer yt-formatted-string 
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.30em !important;}
html[data-page-type=video][it-transcript='true'] ytd-transcript-segment-renderer.active + ytd-transcript-segment-renderer + ytd-transcript-segment-renderer yt-formatted-string 
{margin-bottom:-5px !important; margin-top:-5px !important; font-size:1.24em !important;}
html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript'] ytd-transcript-segment-renderer *
{margin-bottom:-4px !important; margin-top:-4px !important; }

html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript'], 
html[data-page-type=video][it-compactSpacing='true'] *[target-id*='transcript']  ytd-engagement-panel-section-list-renderer #content {
	max-height: 69vh !important;
	margin-top:40px !important;
}

/*--------------------------------------------------------------
# RELATED VIDEO STYLES
--------------------------------------------------------------*/
html[it-related-videos='Focus'] #related #dismissible:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) {opacity:0.8;  max-height:80px; overflow:hidden; margin-top:-1px;  transition: max-height 0.2s ease 0.15s;}
html[it-related-videos='Focus'] #related #dismissible:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) ytd-thumbnail {transform:scale(0.8); transform-origin: top; transition: all 0.2s ease 0.15s;}
html[it-related-videos='Focus'] #related #dismissible:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) ytd-playlist-thumbnail {transform:scale(0.8); transform-origin: top; transition: all 0.2s ease 0.15s;}
html[it-related-videos='Focus'] #related #dismissible:hover:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) {opacity: 1;  max-height: 100px; transition: max-height 0.3s ease 0.1s; margin-left: 0px !important}
html[it-related-videos='Focus'] #related #dismissible:hover:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) ytd-thumbnail {max-width: 170px; transform:scale(1); transition: all 0.3s ease 0.1s;}
html[it-related-videos='Focus'] #related #dismissible:hover:not(.it-blocklisted-video):not(.ytd-reel-item-renderer) ytd-playlist-thumbnail {max-width: 170px; transform:scale(1); transition: all 0.3s ease 0.1s;}

html[it-related-videos='Titles'] #related #dismissible:not(.ytd-reel-item-renderer) {opacity:0.8;  max-height:40px; overflow:hidden; margin-top:-1px;  transition: max-height 0.3s ease 0.1s;}
html[it-related-videos='Titles'] #related #dismissible:not(.ytd-reel-item-renderer) ytd-thumbnail {max-width: 0px; transition: max-width 0.4s ease 0.1s;}
html[it-related-videos='Titles'] #related #dismissible:not(.ytd-reel-item-renderer) ytd-playlist-thumbnail {max-width: 0px; transition: max-width 0.4s ease 0.1s;}
html[it-related-videos='Titles'] #related #dismissible:hover:not(.ytd-reel-item-renderer) {opacity: 1;  max-height: 100px; transition: max-height 0.3s ease 0.9s; margin-left: 0px !important}
html[it-related-videos='Titles'] #related #dismissible:hover:not(.ytd-reel-item-renderer) ytd-thumbnail {max-width: 170px; transform:scale(1); transition: max-width 0.3s ease 0.9s;}
html[it-related-videos='Titles'] #related #dismissible:hover:not(.ytd-reel-item-renderer) ytd-playlist-thumbnail {max-width: 170px; transform:scale(1); transition: max-width 0.3s ease 0.9s;}
html[it-related-videos='Titles'] #related #dismissible #metadata {margin-top:-3px;}
/* timestamps..? html[it-related-videos='Titles'] #overlays {margin-right:100px; margin-bottom:50px; opacity: 1 !important; visiblity: visible !important;} */
/* html[it-related-videos='Titles'] #related #dismissible #metadata * {display: inline-block !important}
*/

/*--------------------------------------------------------------
# SHORTS REMIXING THIS VIDEO
--------------------------------------------------------------*/
html[it-hide-shorts-remixing='true'] #related ytd-reel-shelf-renderer,
/*--------------------------------------------------------------
# HIDE THUMBNAILS
--------------------------------------------------------------*/
html[it-thumbnails-hide='true'] ytd-watch-next-secondary-results-renderer ytd-thumbnail,
html[it-thumbnails-hide='true'] ytd-watch-next-secondary-results-renderer ytd-playlist-thumbnail,
/*update Aug 22th 2025 by @JadonDn:*/ html[it-thumbnails-hide='true'] ytd-watch-next-secondary-results-renderer .yt-lockup-view-model-wiz__content-image,
/*--------------------------------------------------------------
# LIVECHAT
--------------------------------------------------------------*/
html[it-livechat='hidden'] ytd-live-chat-frame#chat {
	  display: none !important;
}
html[it-livechat='collapsed'] #chat-container:not([it-activated])::before {
	content: 'Show live chat' !important;
}

html[it-livechat='collapsed'] #chat-container[it-activated]::before {
	content: 'Collapse live chat' !important;
}

html[it-livechat='collapsed'] #chat-container::before {
	font-family: inherit !important;
	font-size: 1.6rem !important;
	font-weight: 400 !important;

	display: flex !important;

	width: 100% !important;
	height: 48px !important;
	margin: 0 !important;

	color: var(--yt-spec-text-primary) !important;
	border-bottom: 1px solid var(--yt-spec-10-percent-layer) !important;

	justify-content: center !important;
	align-items: center !important;
}

html[it-livechat='collapsed'] #chat-container:not([it-activated]) > ytd-live-chat-frame#chat {
	display: none !important;
}

html[it-livechat='collapsed'][it-livechat='hidden'] ytd-live-chat-frame#chat {
  display: none !important;
}


/*--------------------------------------------------------------
# HIDE PLAYLIST
--------------------------------------------------------------*/
html[it-hide-playlist='true'] ytd-playlist-panel-renderer#playlist,
/*--------------------------------------------------------------
# HIDE RELATED VIDEOS
--------------------------------------------------------------*/
html[it-related-videos='hidden'] #related,
html[it-related-videos='hidden'] #related #contents,
html[it-related-videos='hidden'] #related #dismissible,
html[it-related-videos='hidden'] #related > ytd-watch-next-secondary-results-renderer > #items,
html[data-page-type=video][it-related-videos='hidden'] ytd-compact-video-renderer,
html[data-page-type=video][it-related-videos='hidetabs'] #related #chips, 
html[it-hide-sidebar='true'] #related,
html[it-hide-sidebar='true'] #related > ytd-watch-next-secondary-results-renderer > #items,
html[it-hide-sidebar='true'] div#secondary div#panels,
html[it-hide-sidebar='true'] div#secondary div#donation-shelf {
	display: none !important
}

html[it-related-videos='collapsed'] #related > ytd-watch-next-secondary-results-renderer > #items:not([it-activated])::before {
	content: 'Show more' !important;
}

html[it-related-videos='collapsed'] #related > ytd-watch-next-secondary-results-renderer > #items[it-activated]::before {
	content: 'Show less' !important;
}

html[it-related-videos='collapsed'] #related > ytd-watch-next-secondary-results-renderer > #items::before {
	font-family: inherit !important;
	font-size: 1.6rem !important;
	font-weight: 400 !important;

	display: flex !important;

	width: 100% !important;
	height: 48px !important;
	margin: 0 !important;

	color: var(--yt-spec-text-primary) !important;
	border-bottom: 1px solid var(--yt-spec-10-percent-layer) !important;

	justify-content: center !important;
	align-items: center !important;
}

html[it-related-videos='collapsed'] #related > ytd-watch-next-secondary-results-renderer > #items:not([it-activated]) > * {
	visibility: hidden !important;
	pointer-events: none !important;
}

/*--------------------------------------------------------------
# NO PAGE MARGIN
--------------------------------------------------------------*/

html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #columns.ytd-watch-flexy,
html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #primary.ytd-watch-flexy,
html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #secondary.ytd-watch-flexy {
	max-width: 100% !important;
}
html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #below {
	margin-left: calc(4vh + 3vw - 40px) !important;
} 	

@media screen and (max-width: 2300px) and (min-width: 1250px) {
	html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #secondary.ytd-watch-flexy {
		margin-right: calc (-12px - 0.4vw - 0.4vh) !important;
	}
	html[data-page-type=video][it-no-page-margin='true'] ytd-watch-flexy:not([fullscreen]) #below {
		margin-left: max(18px, calc(19vw - 230px)) !important;
		margin-right:max(18px, calc(13vw - 130px)) !important;
		max-width: 1280px !important;
	} 
}
	
@media screen and (min-width: 2301px) {
	html[data-page-type=video][it-no-page-margin='true'][it-sidebar-left='true'] #secondary {
		left: 15px !important;
	}
	html[data-page-type=video][it-no-page-margin='true']:not([it-player-size='max_width']) #secondary {
		position:absolute !important;  right: 15px;
	}
	html[data-page-type=video][it-no-page-margin='true']:not([it-player-size='1080p']):not([it-player-size='1440p']):not([it-player-size='2160p']):not([it-player-size='custom']):not([it-player-size='max_width']) ytd-watch-flexy:not([fullscreen]) #primary.ytd-watch-flexy {
		max-width: 1280px !important;
	}
	html[data-page-type=video][it-no-page-margin='true']:not([it-player-size='1080p']):not([it-player-size='1440p']):not([it-player-size='2160p']):not([it-player-size='custom']):not([it-player-size='max_width']) ytd-watch-flexy:not([fullscreen]) #below {
		margin-left: 10px !important;
	}
}	

html[data-page-type=video][it-no-page-margin='true'] ytd-browse > ytd-two-column-browse-results-renderer {
	width: auto !important;
	max-width: auto !important;
}

/*--------------------------------------------------------------
# MOVE SIDEBAR LEFT
--------------------------------------------------------------*/
html[data-page-type=video][it-sidebar-left='true'] #columns>#primary,
html[data-page-type=video][it-sidebar-left='true'] #head>#upnext {
	order: 5 !important;
}

html[data-page-type=video][it-sidebar-left='true'] #columns>#secondary>#related {margin-left: calc(0.5vw + 4px); margin-right:1vw !important;}

/*--------------------------------------------------------------
# MOVE THUMBNAILS RIGHT
--------------------------------------------------------------*/
/* Move thumbnails to the right for video suggestions */
html[it-thumbnails-right='true'] #related ytd-watch-next-secondary-results-renderer ytd-thumbnail,
html[it-thumbnails-right='true'] #related .modern-collection-parent,
html[it-thumbnails-right='true'] #related ytd-watch-next-secondary-results-renderer ytd-playlist-thumbnail,
html[it-thumbnails-right='true'] #related ytd-compact-playlist-renderer ytd-thumbnail {
	order: 5 !important;
}

/*--------------------------------------------------------------
# STICKY NAVIGATION
--------------------------------------------------------------*/
/* Prevent left navigation from auto-hiding */
html[it-sticky-navigation='true'] ytd-mini-guide-renderer {
	transform: translateX(0) !important;
	transition: none !important;
}

html[it-sticky-navigation='true'] ytd-mini-guide-renderer[hidden] {
	display: block !important;
	transform: translateX(0) !important;
}

html[it-sticky-navigation='true'] ytd-mini-guide-renderer[aria-hidden="true"] {
	aria-hidden: false !important;
	transform: translateX(0) !important;
}

/* Ensure the guide is always visible */
html[it-sticky-navigation='true'] ytd-guide-renderer {
	transform: translateX(0) !important;
	transition: none !important;
}

html[it-sticky-navigation='true'] ytd-guide-renderer[hidden] {
	display: block !important;
	transform: translateX(0) !important;
}

html[it-sticky-navigation='true'] ytd-guide-renderer[aria-hidden="true"] {
	aria-hidden: false !important;
	transform: translateX(0) !important;
}

/* Override any auto-hide animations */
html[it-sticky-navigation='true'] ytd-mini-guide-renderer,
html[it-sticky-navigation='true'] ytd-guide-renderer {
	animation: none !important;
	transition: none !important;
}

/* Ensure the guide button doesn't hide the navigation */
html[it-sticky-navigation='true'] ytd-masthead ytd-button-renderer[is="ytd-button-renderer"] {
	display: none !important;
}

/* Move thumbnails to the right for playlist suggestions (non-Polymer) */
html[it-thumbnails-right='true'] #related yt-lockup-view-model .yt-lockup-view-model-wiz {
	display: flex !important;
	flex-direction: row-reverse !important;
	align-items: flex-start !important;
}

/* Adjust spacing between image and metadata */
html[it-thumbnails-right='true'] #related yt-lockup-view-model .yt-lockup-view-model-wiz__content-image {
	margin-left: 12px !important;
	margin-right: 0 !important;
}

  

