:root {
	--sidebar-width: min(312px, 100%);
	--contents-padding: 30px;
}
@media screen and (max-width: 1200px) {
	:root {
		--contents-padding: 16px;
	}
}
/* Posts */
#postsFrame {
	border: none;
}
#contents {
	background: #dae0e6;
	width: 100%;
	flex: 1;
	left: 0px;
	bottom: 0px;
	padding: calc(var(--contents-padding) / 2) var(--contents-padding) var(--contents-padding) var(--contents-padding);
	overflow: visible;
	min-height: max-content;
}
r-post, .post {
	border: 1px #ccc solid;
	border-radius: 4px;
	background: #fff;
	margin: 0 auto;
	max-width: 640px;
	min-width: 250px;
	padding: 8px 16px;
	padding-left: 48px;
	margin-bottom: 15px;
	display: flex;
	gap: 10px;
	color: #aaa;
	position: relative;
}
r-post[novotes="true"], .post[novotes="true"] {
	padding-left: 16px;
	min-height: auto;
}
r-post .hider {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: #8080804d;
	backdrop-filter: blur(8px);
	color: black;
	display: flex;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	border-radius: 4px;
	z-index: 1;
}
r-post .body, .post .body {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	margin: 2px 0;
	row-gap: 4px;
}
r-post .header, .post .header {
	display: flex;
	column-gap: 6px;
}
r-post > .cover-image, .post > .cover-image {
	width: 40px;
	height: 40px;
}
r-post .main > .description, .post .main > .description {
	white-space: preserve-breaks;
	word-wrap: anywhere;
}
r-post .main > .title, .post .main > .title {
	color: black;
}
/* main.authored - Community (non-system) posts */
r-post .main.authored, .post .main.authored {
	display: flex;
	flex-direction: column;
	row-gap: 4px;
}
r-post .main.authored > .title, .post .main.authored > .title {
	text-decoration: underline;
}
r-post .main.authored > .description, .post .main.authored > .description {
	color: black;
}
r-post > r-clipboard-copy, .post > r-clipboard-copy {
	align-self: center;
}
/* r-post only */
r-post {
	min-height: 76px;
}
r-post .author-container {
	display: flex;
	column-gap: 4px;
	align-items: center;
	font-weight: lighter;
}
r-post .author-container > *, r-post .author-container > a > span {
	font-size: 12px;
	color: #aaa;
	margin-bottom: 8px;
}
r-post .author-image {
	border-radius: 100%;
	padding: 2px;
	border: 1px solid lightgrey;
}
r-post .author-name {
	text-decoration: underline;
	position: relative;
}

.post-inline-ad {
	display: flex;
	justify-content: center;
	overflow: hidden;
	min-height: 128px !important;
}
.post-inline-ad > div {
	flex-grow: 1;
}

r-votes, .r-votes {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 40px;
	background: #f8f9fa;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 4px;
	border-radius: 4px 0px 0px 4px;
}
r-votes > svg {
	fill: #888a8c;
	border-radius: 2px;
	padding: 3px;
	min-width: 24px;
	min-height: 24px;
	cursor: pointer;
}
r-votes > svg.down {
	transform: rotate(180deg);
}
r-votes > svg:hover {
	background: #1a1a1b1a;
}
r-votes > svg:hover, r-votes > svg.voted {
	fill: #cc3700;
}
r-user-tooltip {
	position: absolute;
	background: white;
	width: max-content;
	height: max-content;
	z-index: 1;
	top: calc(100% + 4px);
	left: 0;
	border-radius: 4px;
	box-shadow: 0px 2px 4px grey;
	color: black;
	padding: 8px;
	display: flex;
	flex-direction: column;
	row-gap: 4px;
}
r-user-tooltip::before {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	background: linear-gradient(to right, #7b71ef, #3d6dde);
	content: "";
	border-radius: 4px 4px 0px 0px;	
}
r-user-tooltip > hr {
	opacity: 0.2;
}
r-user-tooltip > span {
	color: #aaa;
	font-size: 12px;
}
.user-tooltip-header {
	display: flex;
	align-items: center;
	column-gap: 4px;
}
.user-tooltip-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: auto min-content;
	column-gap: 2px;
	flex-grow: 1;
}
.user-tooltip-grid > span {
	color: #aaa;
}
r-clipboard-copy {
	position: relative;
	height: 30px;
	width: 30px;
}
r-clipboard-copy .copy-status {
	opacity: 0;
	position: absolute;
	left: 0;
	transform: translate(-100%, -50%);
	min-width: max-content;
	top: 50%;
}
r-post-contents .contents-album {
	/*height: 360px;*/
	border-radius: 16px;
	overflow: clip;
	display: grid;
	grid-gap: 2px;
	border-radius: 4px;
}
r-post-contents .contents-album > img {
	border: 1px solid lightgray;
	border-radius: 2px;
	width: 100%;
	height: 100%;
	object-fit: cover;
	cursor: pointer;
}
r-post-contents > dialog {
	height: fit-content !important;
	width: fit-content !important;
	max-height: calc(100% - 32px);
	max-width: calc(100% - 32px);
}
@media screen and (max-width: 450px) {
	r-post-contents > dialog {
		width: calc(100% - 32px) !important;	
	}
}
r-post-contents .dialog-header {
	display: flex;
	height: 36px;
	padding: 4px;
	flex-direction: row !important;
	column-gap: 8px;
	align-items: center;
}
r-post-contents .dialog-header > a  {
	opacity: 0.8;
	font-size: 14px;
}
r-post-contents .dialog-header > r-close-icon {
	height: 24px;
	width: 24px;
	margin-left: auto;
}
r-post-contents > dialog > img {
	width: 100%;
}

#createPostPost {
	flex-direction: column;
	row-gap: 0px !important;
}
#createPostPost.focused {
	row-gap: 10px !important;
}
#createPostPost.image-drop {
	outline: 4px solid #0cafff;
}
.create-post-image-drop {
	display: none;
}
#createPostPost.image-drop > .create-post-image-drop {
	display: flex;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: #0cafff4d;
	color: black;
	justify-content: center;
	align-items: center;
	font-size: 16px;
	pointer-events: none;
	column-gap: 4px;
}
.create-post-body {
	display: flex;
	flex-grow: 1;
	min-height: 44px;
	column-gap: 8px;
}
.create-post-inputs-container {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	min-width: 128px;
}
.create-post-input {
	all: unset;
	background-color: #F6F7F8;
	border-radius: 4px;
	border: 1px solid #EDEFF1;
	box-shadow: none;
	box-sizing: border-box;
	color: #1c1c1c;
	display: block;
	flex-grow: 1;
	font-size: 16px;
	padding: 0 16px;
	cursor: text;
}
.create-post-input:invalid {
	border: 1px solid #c40c0ce1;
}
.create-post-input:hover {
	background-color: #FFFFFF;
	border: 1px solid #0079D3;
}
.create-post-account-button {
	width: 32px;
	height: 32px;
	margin-top: 8px;
}
.create-post-content-button {
	box-shadow: none;
	padding: 0px;
	width: 32px;
	height: 32px;
	margin-top: 8px;
	background-color:white;
	border: none;
}
#createPostInput {
	min-height: 42px;
	height: 42px;
	max-height: 42px;
	overflow-x: hidden;
	overflow-y: auto;
	transition: .2s height, .2s max-height;
	word-break: break-word;
	white-space: pre-wrap;
	z-index: 1;
}
#createPostInput::placeholder {
	line-height: 36px;
}
#createPostPost.focused #createPostInput, #createPostInput:focus,
#createPostInput:focus-within, #createPostInput:active {
	padding-top: 8px;
	height: 256px;
	max-height: 256px;
}

#createPostPost.focused #createPostInput::placeholder,
#createPostInput:focus::placeholder,
#createPostInput:focus-within::placeholder,
#createPostInput:active::placeholder {
	line-height: 20px;
}
.create-post-extra {
	opacity: 0;
	height: 0px;
	max-height: 0px;
	transition: .2s opacity, .2s height, .2s max-height, .2s margin;
}
#createPostTitle {
	display: flex;
}
#createPostOptions {
	display: flex;
	justify-content: end;
	margin-right: 36px;
	column-gap: 8px;
	opacity: 0;
	height: 0px;
	transition: .2s opacity, .2s height, .2s max-height;
}
#createPostPost.focused .create-post-extra {
	opacity: 1;
	height: 36px;
	max-height: 256px;
}
#createPostPost.focused #createPostOptions {
	height: fit-content !important;
}
#createPostPost.focused #createPostTitle {
	margin-top: 6px;
	margin-bottom: 8px;
}
r-post-contents-preview {
	display: flex;
	column-gap: 8px;
	flex-grow: 1;
	transition: .2s height;
}
r-post-contents-preview > span {
	align-self: center;
	min-width: min-content;
}
r-post-contents-preview > div {
	overflow-x: scroll;
	display: flex;
	column-gap: 8px;
}
r-create-post-content {
	position: relative;
	overflow: clip;
}
r-create-post-content > img {
	height: 72px;
	border: 1px solid gray;
	border-radius: 4px;
}
r-create-post-content > button {
	position: absolute;
	left: 0;
	top: 0;
	width: 24px;
	height: 16px;
	border-radius: 4px 0px 4px 0px;
	box-shadow: none;
	padding: 0;
	background: #000000b8;
}
.post-button {
	border-radius: 64px;
	width: 72px;
	box-shadow: none;
}
.post-button:disabled {
	opacity: 0.6;
}
.create-post-create-discard {
	display: flex;
	justify-content: end;
	gap: 8px;
}
.discard-post-button {
	border: 1px solid #676767;
	color: gray;
}
.create-post-button {
	color: white;
	background-color: #ff4500;
}
.create-post-status {
	opacity: 0.6;
	position: absolute;
	bottom: 4px;
	width: 144px;
}

.posts-button {
	color: black;
	border: 1px solid #ccc;
	border-radius: 4px;
	box-shadow: none;
	background: white;
	display: flex;
	align-items: center;
	padding: 6px;
	height: fit-content;
}
.posts-side-panel {
	display: block;
	position: absolute;
	height: 600px;
	right: calc(50% - 680px);
}
.posts-jump-button {
	position: sticky;
	top: 16px;
}
@media screen and (max-width: 1200px) {
	.posts-side-panel {
		margin-left: auto;
		margin-right: auto;
		width: fit-content;
		margin-bottom: 8px;
		position: static;
		height: auto;
	}
	#createPostOptions {
		display: flex;
		flex-direction: column;
		row-gap: 8px;
	}
}

/* Page */
body, html {
	height: max-content;
	overflow-y: hidden;
	background: #dae0e6;
}
html[embedded="false"], html[embedded="false"] body {
	height: 100%;
}
html[embedded="false"] body {
	overflow-y: scroll;
}
html[embedded="false"] header {
	position: sticky;
	top: 0;
	left: 0;
	width: 100%;
	height: 64px;
	background-color: white;
	margin: 0;
	padding: 8px;
	border-bottom: 1px solid #EDEFF1;
	display: flex;
	column-gap: 8px;
	z-index: 1;
	align-items: center;
	justify-content: space-between;
}
html[embedded="false"] r-post-contents > dialog {
	top: 50%
}
html[embedded="true"] .posts-extern-buttons {
	display: flex;
	column-gap: 8px;
}
html[embedded="false"] .posts-extern-buttons {
	display: none;
}
.header-icon {
	height: 100%;
}
.header-menu {
	width: 36px;
	height: 36px;
	padding: 0;
	margin-right: 8px;
	box-shadow: none;
}
.header-title-container {
	display: flex;
	align-items: center;
	height: 100%;
}
.header-title {
	display: none;
}
html[embedded="true"] header {
	display: none;
}
.sidebar-background {
	position: fixed;
	background: rgba(0, 0, 0, 0.2);
	width: 100%;
	height: 100%;
	top: 64px;
	z-index: 1;
	pointer-events: none;
}
.sidebar {
	position: fixed;
	top: 64px;
	left: 0;
	width: var(--sidebar-width);
	height: calc(100% - 64px);
	background: white;
	z-index: 2;
	border-left: 1px solid white;
	display: flex;
	flex-direction: column;
	row-gap: 8px;
	padding: 8px;
}
html[embedded="true"] .sidebar {
	display: none;
}
.sidebar-footer {
	margin-top: auto;
	text-align: center;
	display: flex;
	justify-content: space-between;
	padding-left: 16px;
	padding-right: 16px;
}
.sidebar > a {
	height: 48px;
	padding: 8px;
	display: flex;
	align-items: center;
	text-decoration: none;
	color: black;
	border-radius: 8px;
	column-gap: 8px;
}
.sidebar > a:hover {
	background: #F6F8F9;
}
.post-input {
	background-color: #F6F7F8;
	border-radius: 4px;
	border: 1px solid #EDEFF1;
	box-shadow: none;
	box-sizing: border-box;
	color: #1c1c1c;
	font-size: 16px;
	padding: 0 16px;
	cursor: text;
}
.post-input:hover {
	background-color: #FFFFFF;
	border: 1px solid #0079D3;
}
.searchbar {
	border-radius: 64px;
	height: 48px;
	width: min(640px, 80%);
}
@media screen and (min-width: 1200px) {
	.header-title-container {
		width: calc(var(--sidebar-width) - 8px);
	}
	.searchbar {
		position: absolute;
		left: calc(50% + var(--sidebar-width) / 2 - var(--contents-padding) / 2);
		transform: translateX(-50%);
	}
	.header-menu {
		display: none;
	}
	.header-title {
		display: block;
	}
	html[embedded="false"] #contents {
		padding-left: var(--sidebar-width);
	}
}
dialog {
	margin: 0 !important;
	position: fixed;
	left: 50%; /* insanity */
	transform: translate(-50%, calc(-50% + var(--posts-dialog-top)));
}
* {
	touch-action: auto !important;
}

/* Reddit-themed dialog & modal styles (ported from instance manager) */
#loginPanel[data-page] > div[page] {
	display: none;
}
#loginPanel[data-page="unauthed"] > div[page="unauthed"],
#loginPanel[data-page="profile"] > div[page="profile"] {
	display: flex;
}

#verificationCode {
	height: 64px;
	font-size: 42px;
	text-align: center;
	margin: 8 0 0 0;
}

#loginSignupMessage {
	color: red;
	font-weight: bold;
}

#unauthedPage[data-page] > div[page] {
	display: none;
}
#unauthedPage[data-page="signin"] > div[page="signin"],
#unauthedPage[data-page="signup"] > div[page="signup"],
#unauthedPage[data-page="authcode"] > div[page="authcode"] {
	display: flex;
}

.reddit-modal {
	margin: auto;
	border: 1px solid gray;
	border-radius: 4px;
	background-color: #f0f0f0;
	height: 600px;
	width: min(800px, 100% - 16px);
	box-shadow: 0px 0px 12px black;
	overflow: clip;
	display: none;
	flex-direction: column;
}
.reddit-modal[open] {
	display: flex;
}
/* i.e loginPanel */
.reddit-modal > div {
	display: flex;
	flex-grow: 1;
	max-height: 100%;
}
.reddit-modal {
	font-family: 'IBM Plex Sans', sans-serif;
	font-size: 20px;
}
.reddit-modal p, a, span {
	font-size: 16px;
}
.reddit-modal p {
	margin-top: 20px;
	margin-bottom: 20px;
}
.reddit-modal .header {
	color: black;
	padding: 16px;
	background: url(images/reddit-login-banner.png);
	background-size: cover;
	min-width: 144px;
	width: 144px;
}
.reddit-modal .body {
	margin: 8px;
	display: flex;
	flex-direction: column;
	row-gap: 8px;
	flex-grow: 1;
}
.reddit-modal .section {
	display: flex;
	flex-direction: column;
	row-gap: 8px;
}
.reddit-modal, .body, .reddit-modal .body {
	touch-action: manipulation;
}
@media (orientation: portrait) {
	.reddit-modal > div {
		flex-direction: column;
		position: relative;
	}
	.reddit-modal .header {
		background: #343536;
		color: white;
		width: auto;
	}
	#accountDialog r-close-icon svg {
		fill: white;
	}
	.reddit-modal .confirm-button {
		position: absolute;
		bottom: 8px;
		width: calc(100% - 16px);
	}
	.reddit-card {
		flex-direction: column;
		height: fit-content !important;
	}
}
.reddit-modal-input {
	all: unset;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 8px;
	font-size: 14px;
	outline: none;
	height: 14px;
	margin: 0;
	background-color: white;

}
.reddit-modal-input[type=file]::file-selector-button {
	all: unset;
	border-radius: 5px;
	background-color: white;
	border: 0px solid black;
	box-shadow: none;
	height: 100%;
}
.reddit-modal-input[type=file] {
	height: 48px;
	background-color: transparent;
}
.reddit-modal-input:focus {
	border-color: #369;
	box-shadow: 0 0 5px #ccc;
}
.reddit-signin-button {
	border: 1px solid #dbdbdb;
	border-radius: 4px;
	background-color: white;
	width: fit-content;
	display: flex;
	height: 46px;
	column-gap: 8px;
	cursor: pointer;
	padding-right: 8px;
	box-shadow: none;
}
.reddit-modal-button {
	all: unset;
	display: inline-block;
	padding: 8px 16px;
	border: none;
	border-radius: 4px;
	background-color: #cee3f8;
	color: #1a1a1b;
	font-size: 14px;
	font-weight: bold;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease-in-out;
}
.reddit-modal-button:hover {
	background-color: #b0c8e6;
}
.reddit-card {
	height: 150px;
	margin: 16px;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 10px;
	margin-bottom: 10px;
	position: relative;
	background: white;
	display: flex;
	column-gap: 16px;
}

.profile-section {
	overflow-y: auto;
}
#profileName {
	margin-top: 0px;
	margin-bottom: 8px;
	font-weight: 600;
}
#profileBio {
	margin-bottom: 16px;
	margin-top: 0px;
}
.profile-section > div {
	margin: 0px;
	overflow: hidden;
	white-space: nowrap;
	position: relative;
	transition: .2s all;
}
.profile-editable > summary {
	display: flex;
	column-gap: 4px;
}
.profile-editable > summary svg {
	margin-left: auto;
}
.profile-section > div.profile-editable:hover {
	overflow: visible;
	background-color: white;
	box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.243);
	border-radius: 4px;
	min-width: fit-content;
	z-index: 2;
	padding: 4px;
}
