:root,
* {
    box-sizing: border-box !important;
    outline: 0px solid transparent !important;
    --matter-helper-theme: 165, 117, 98;
    --matter-onsurface-rgb: 163, 165, 170;

    --card-height: 15rem;
}
body,
html {
    padding: 0 !important;
    margin: 0 !important;
	max-width: 100vw;
	width: auto;
}
:root {
    font-size: 16px;
}

#main-grid {
    display: grid;
    grid-template: max-content 1fr min-content / 1fr;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    padding: 1rem;
}
#main-grid.details-open {
    grid-template-columns: 1fr minmax(min-content, 30%);
    grid-column-gap: 1rem;
}
#inpholder {
    grid-row: 1 / 2;
    padding: 0.8rem 0;
}
#main-grid.details-open #inpholder { grid-column: 1 / 3; }
#main-grid.details-open #footer { grid-column: 1 / 3; padding-bottom: 1rem; }

#results {
    grid-row: 2 / 3;
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 0.8rem;

    display: flex;
    justify-content: center;
    align-items: space-between;
    flex-wrap: wrap;
}

#search,
#inpholder label {
    width: 100%;
}
/*result card*/

.result-card {
    display: grid;
    grid-template-rows: 1fr max-content max-content;
    height: min-content;
    margin: 0.5rem !important;
    width: 10.5rem;
    row-gap: 0.2rem;
}
.poster {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: var(--card-height);
    width: min-content;
    background: var(--bg-primary);
    border-radius: 0.5rem !important;
    position: relative;
}
/* poster aspect ratio should be 2:3 (because i said so) */
.poster-img {
    border-radius: 0.5rem !important;
    height: 100%;
    aspect-ratio: 2/3;
}
.contain {
    /* for landscape images */
    object-fit: contain !important;
}
/* removed the cover class as it was unneeded */
.poster-open {
    position: absolute;
    background: #262626be;
    color: var(--text);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: 1rem;
    text-decoration: none;
    font-weight: bold;
}
.poster-open:hover {
    opacity: 1;
}
.title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
#footer,
#nothing {
    color: gray;
    text-align: center;
    padding-top: 1rem;
	padding-bottom: 0.5rem;
}
#footer {
	box-sizing: border-box;

	display: flex;
	align-items: center;
	justify-content: center;

	line-height: 16px;
	font-size: 16px;
	flex-wrap: wrap;
	row-gap: .4rem;

	max-width: 100%;
}
#footer #tmdb-img { opacity: 0.25; transition: opacity 0.2s ease-in-out; }
#footer #tmdb-img:hover { opacity: 1; }
#footer a { margin: 0 5px; }
#nothing img {
    width: 30%;
    height: auto;
    filter: saturate(77%);
}
#nothing {
    font-weight: bold;
}
.poster-open {
    display: none;
}
.card-hover {
    opacity: 0;
    position: absolute;
    background: #1b1b1be7;
    transition: opacity 0.2s;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template: min-content 1fr min-content min-content min-content min-content / 1fr 1fr;
    grid-gap: 0.3rem;
    padding: 0.3rem;
}
.card-hover button,
#details-rating-wrapper button {
    --matter-helper-theme: 165, 117, 98;
    --matter-onsurface-rgb: 163, 165, 170;
    white-space: nowrap;
    background: #262626de;
}
.poster:hover .card-hover,
.card-hover:hover {
    opacity: 1;
}

.vimdb {
    grid-area: 3 / 1 / 4 / 2;
}
.cimdb {
    grid-area: 3 / 2 / 4 / 3;
}
.vtmdb {
    grid-area: 4 / 1 / 5 / 2;
}
.ctmdb {
    grid-area: 4 / 2 / 5 / 3;
}
.details {
    grid-area: 6 / 1 / 7 / 3;
}
.hr-text.csep {
    grid-area: 5 / 1 / 6 / 3;
    margin: 0;
    line-height: 0.5rem;
    height: 0.5rem;
}
.type {
    grid-area: 1 / 1 / 2 / 3;
    width: min-content;
    white-space: nowrap;
    padding: 0.1rem 0.5rem;
    border-radius: 100rem;
    font-weight: 500;
    color: var(--fg-rosebox);
    font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
    border: 1px solid;
    border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24);
}
.poster:hover .poster-img {
    opacity: 0.5;
} 
.poster.noblur:hover .poster-img {
    opacity: 0.5;
}
.poster:hover {
    overflow: hidden;
}
#copyinp {
    opacity: 0;
    position: absolute;
    top: -100px;
}

/*details*/
#details-screen {
    background: var(--bg-secondary);
    grid-row: 2 / 3;
    grid-column: 2 / 3;
    width: 100%;
    height: 100%;
    border-radius: 1rem;
	min-width: 36rem;
}
#details-header {
    position: relative;
    width: 100%;
    background-repeat: no-repeat;
    background-position: top;
    background-size: contain;
    border-radius: 1rem 1rem 0 0;
}
#details-x-button span {
    filter: drop-shadow(0px 0px 0.5rem black);
    color: white;
    cursor: pointer;
    user-select: none;
    z-index: 4;
}
.fallback-bg {
    background-image: url("fallback-bg.png");
}
#details-header-content {
    display: grid;
    grid-template: 15rem repeat(6, min-content) 1fr / 10.4rem 1fr;
	grid-template-areas: 
	"close bg"
	"poster title"
	"poster line2"
	"poster tags"
	"poster description"
	"nothing description"
	"rating-buttons description"
	"external-ratings description";
    column-gap: 1rem;
    padding: 1rem;
    height: 100%;
    /* border-radius: 1rem 1rem 0 0; */
	border-radius: 1rem;
    z-index: 3 !important;
}
#details-header-content * {
    z-index: 3 !important;
}
#details-title {
	grid-area: title;
}
#details-backdrop {
	grid-area: bg;
    width: 100%;
    max-height: 20rem;
    opacity: 0.4;
}
#details-backdrop-fade {
    position: absolute;
    top: 0;
    height: 20rem;
    background: linear-gradient(00deg, var(--bg-secondary) 20%, transparent 100%);
    z-index: 2;
    width: 100%;
}
#details-backdrop-fade-rest {
    position: absolute;
    height: 100%;
    top: 19rem;
    background: var(--bg-secondary);
    z-index: 2;
    width: 100%;

    max-height: calc(100% - 19rem);
	border-bottom-left-radius: 1rem;
	border-bottom-right-radius: 1rem;
}
#details-poster-wrapper {
    grid-area: 2 / 1 / 7 / 2;
    border-radius: 0.5rem !important;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
#details-poster {
    height: auto;
    width: 10.4rem;
    border-radius: 0.5rem !important;
}
#details-title {
    font-size: 30px;
    font-weight: 600;
    margin: 0;
	line-height: 42px;
}
#details-x-button {
    grid-area: close
}
#details-year {
    opacity: 0.5;
    font-weight: 400;
}
#details-genres {
	margin-top: 0.25rem;
    grid-area: tags;
    display: flex;
    flex-wrap: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
#details-genres::-webkit-scrollbar {
    display: none;
}
.details-genre {
    padding: 0.1rem 0.5rem;
    /* border-radius: 100rem; */
	border-radius: 5px;
    font-weight: 500;
    color: var(--fg-rosebox);
    font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
    border: 1px solid;
    border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24);
    margin: 0.1rem;
    white-space: nowrap;
}
.details-genre:first-child { margin-left: 0; }
#details-overview {
	grid-area: description;
	height: 100%;
    max-height: 15rem;
    overflow-y: scroll;
	margin-top: 0.7rem;
}
#details-rating-wrapper {
	grid-area: rating-buttons;
	height: 80px;
	margin-top: 1rem;

	display: grid;
	column-gap: 0.5rem;
	row-gap: 0.25rem;

	grid-template: 1fr 1fr / 80px 1fr;
	grid-template-areas:
	"rating trailer"
	"rating pluggedin";
	align-items: center;
	justify-content: start;
}
#details-external-ratings {
	grid-area: external-ratings;
	margin-top: 1rem;
	height: 50px;
	
	display: grid;
	column-gap: 0.5rem;
	row-gap: 0;

	grid-template: 1fr min-content / repeat(3, 1fr);
	grid-template-areas: 
	"imdb-r rotten-r meta-r"
	"imdb-l rotten-l meta-l";
	align-items: center;
	justify-content: center;
	text-align: center;
}

#imdb-rating { grid-area: imdb-r; }
#rotten-rating { grid-area: rotten-r; }
#metacritic-rating { grid-area: meta-r; }

#imdb-rating,
#rotten-rating,
#metacritic-rating {
	font-family: 'Courier New', monospace;
	font-weight: bolder;
	font-size: 24px;
	line-height: 24px;
	padding-top: 0.15rem;
}

.details-spacer {
    margin: 0 0.5rem;
}
#details-type-length {
	grid-area: line2;
}
#trailerbtn {
	grid-area: trailer;
}
/* #details-pg {
    padding: 0.5rem;
    border: 1px solid;
    border-color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24);
    border-radius: 5px;
    height: 36px;
    display: flex;
    align-items: center;
    white-space: nowrap;
} */
.rect-pill, #details-pg {
	border: 1px solid rgba(255,255,255,0.6);
	color: #a3a5aa;
	padding: 0.06em 4px 0.15em 4px !important;
	border-radius: 5px;
	background-color: transparent;
	margin-right: 7px;

	display: inline-flex;
    white-space: nowrap;
    align-items: center;
    align-content: center;
    
    line-height: 1;
}

#details-pg {
	grid-area: pg;
	/* color: white;
	background: #a57562;
	border-color: rgba(165, 117, 98, 0.2); */
	height: min-content;
}

/* colors for different ratings */
#details-type-length[data-rating-color="-1"] #details-pg,
#details-type-length[data-rating-color="0"] #details-pg {
	background-color: #1D1D20;
	color: #a3a5aab2;
	border-color: #a3a5aab2;
}

#details-type-length[data-rating-color="6"] #details-pg,
#details-type-length[data-rating-color="7"] #details-pg,
#details-type-length[data-rating-color="9"] #details-pg,
#details-type-length[data-rating-color="10"] #details-pg,
#details-type-length[data-rating-color="11"] #details-pg {
	background-color: #205536;
	color: #4EFF93;
	border-color: #4EFF93;
}

#details-type-length[data-rating-color="12"] #details-pg,
#details-type-length[data-rating-color="13"] #details-pg,
#details-type-length[data-rating-color="14"] #details-pg {
	background-color: #123952;
	color: #1FA1F1;
	border-color: #1FA1F1;
}

#details-type-length[data-rating-color="15"] #details-pg,
#details-type-length[data-rating-color="16"] #details-pg,
#details-type-length[data-rating-color="17"] #details-pg {
	background-color: #55391E;
	color: #FFA143;
	border-color: #FFA143;
}

#details-type-length[data-rating-color="18"] #details-pg,
#details-type-length[data-rating-color="21"] #details-pg {
	background-color: #55191A;
	color: #FF3636;
	border-color: #FF3636;
}


#pluggedin {
	grid-area: pluggedin;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
#pluggedinicon {
    height: 100%;
    width: auto;
    opacity: 0.8;
}
#pluggedinicon path {
    fill: rgb(0, 100, 0);
}

#score-hold {
	grid-area: rating;
	display: grid;
	place-items: center;
	grid-template: 1fr / 1fr;
	grid-template-areas: "score";
	align-self: start;
}

/* score */
#score-text {
    font-size: 1.5rem;
	line-height: 1.5rem;
    font-family: var(--matter-font-family, "Roboto", "Segoe UI", BlinkMacSystemFont, system-ui, -apple-system);
	font-weight: 500;

	background: transparent;
    height: min-content;

    display: flex;
    justify-content: center;
    align-items: flex-start;

	grid-area: score;
}
#score-percent {
	font-size: 1rem;
	line-height: 1.5rem;
}

/* score circle */
:root {
    --PI: 3.14159265358979;
    --circle-circumstance: calc(2 * var(--PI) * 40);
}
#score-svg {
    width: 80px;
    height: 80px;
}

.circular-progress[data-feel="bad"] {
	color: #cc3c3c;
}
.circular-progress[data-feel="good"] {
	color: rgb(67, 153, 67);
}
.circular-progress[data-feel="great"] {
	color: rgb(0, 214, 0);
}
.circular-progress[data-feel="null"] {
	color: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24);
}

.circular-progress svg {
    transform: rotate(270deg);
	grid-area: score;
	pointer-events: none;
}
.circular-progress circle {
    stroke-width: 5;
    fill: none;
    stroke-linecap: round;
}
.circular-progress circle:nth-of-type(1) {
    stroke: rgba(var(--matter-onsurface-rgb, 0, 0, 0), 0.24);
}
.circular-progress circle:nth-of-type(2) {
    stroke: currentColor;
    stroke-dasharray: var(--circle-circumstance);

    /* here we multiply the circle circumstance by an opposite number of what we want it to present */
    /* so here we want it to present 70% which means 0.7 and the opposite of that is 0.3 ( 1 - 0.7 ) */
    stroke-dashoffset: (0 * var(--circle-circumstance));
}

/* phone view */
@media only screen and (max-width: 768px) {
	:root {
		--phone-max-width: calc(100vw - 0.5rem);
		--phone-input-px-height: 78px;
	}

	body, html { overflow-x: hidden; }
	#main-grid #footer { 
		padding-bottom: 1rem;
		max-width: var(--phone-max-width);
	}
	#main-grid.details-open #footer { display: none }
	*::-webkit-scrollbar { display: none; }
	#results {
		padding: 0.75rem 0.25rem;
		width: 100%;
		gap: 0.25rem;

		display: grid;
		grid-template-columns: 1fr 1fr;
		grid-auto-flow: row;
		justify-items: center;
	}
	.result-card {
		margin: 0 !important;
		justify-self: center;
	}
	#nothing { grid-column: 1 / 3; }
	#inpholder {
		max-width: var(--phone-max-width);
		padding: 0.5rem 0.25rem;
	}
	#main-grid {
		padding: 0rem 0.25rem 0rem 0.25rem;
	}
    #main-grid.details-open #inpholder,
    #main-grid.details-open #footer {
        grid-column: 1 / 2;
    }
    #main-grid.details-open #results {
        display: none;
    }
    #main-grid.details-open {
        grid-template-columns: 1fr;
        /* padding-left: 0px;
        padding-right: 0px; */
    }
	#main-grid.details-open #details-header { margin-bottom: 0.25rem; }
    #main-grid.details-open #details-header-content {
		grid-template: 3rem minmax(249.58px, min-content) repeat(6, min-content) 1fr / 1fr 1fr;
        grid-template-areas: 
		"close close"
		"poster poster"
		"title title"
		"line2 line2"
		"tags tags"
		/* "rating-buttons rating-buttons"
		"external-ratings external-ratings" */
		"rating-buttons external-ratings"
		"rating-buttons external-ratings"
		"description description";
    }
	#main-grid.details-open #details-rating-wrapper {
		width: 100%;
		/* grid-template: 1fr 1fr / 80px repeat(2, minmax(max-content, 1fr));
		grid-template-areas:
		"rating trailer pluggedin"
		"rating trailer pluggedin"; */
	}
	/* turn off if old 2 row layout */
	#details-external-ratings { height: 80px; }
    #main-grid.details-open #details-screen {
		grid-column: 1 / 2;
        max-width: var(--phone-max-width);
        grid-template-columns: 1fr;
		min-width: unset;

		min-height: calc(100vh - var(--phone-input-px-height) - 1rem)
    }
    #main-grid.details-open #details-screen #details-poster-wrapper {
       grid-area: poster;
    }
    #main-grid.details-open #details-screen #details-title {
        grid-area: title;
        position: relative;
        bottom: 0;
        padding-bottom: 0.2rem;
        margin-top: 1rem;
        height: auto;
    }
    #main-grid.details-open #details-backdrop-fade-rest {
        top: 19rem;
		position: absolute !important;
    }
	/* #details-backdrop-fade {
		height: 20.2rem;
	} */
}

