@import url(reset.css);

:root {
	--white: #e8ebe2;
	--black: #000000;
	--foreground: var(--black);
	--background: var(--white);
	--danger: #BB4430;
	--success: #527E3A;
	--selected: #8AA0BC;
	
	--gap-m: clamp(20px, 5vh, 80px);
	--gap-s: calc(var(--gap-m) / 2);
	--gap-xs: calc(var(--gap-s) / 2);


	font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
	color: var(--foreground);
}

body {
	background: var(--background);
}

/* 	Header
	===================================================*/

header,
.section-header {
	height: clamp(80px, 10vh, 140px);
	display: flex;
	align-items: center;
	justify-content: end;
	gap: var(--gap-s);
	padding: 0 var(--gap-m);
	background: var(--white);
	color: var(--black);
}

header .logo,
.section-header h2 {
	display: flex;
	align-items: center;
	white-space: nowrap;
	gap: var(--gap-xs);
	margin-right: auto;
}

header .logo h1,
.section-header h2 {
  	font-size: clamp(24px, 4vh, 48px);
}

.logo img{
	height: clamp(30px, 5vh, 70px);
}

header button img,
.section-header button img {
	height: clamp(20px, 3vh, 40px);
}

header button,
.section-header button {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: var(--gap-xs);
	background: transparent;
	border: 2px solid var(--foreground);
	border-radius: var(--gap-m);
	padding: calc(var(--gap-xs) / 2) var(--gap-xs);
	font-size: 18px;
}


/* 	Main
	===================================================*/


main {
	padding: var(--gap-s) var(--gap-m);
}

.disclaimer {
	width: min(100%, 540px);
	margin: auto;
}

.gdpr-banner {
	display: flex;
	flex-direction: column;
	gap: var(--gap-s);
}

.modal label.upload-check {
	display: flex;
	flex-direction: row;
	gap: var(--gap-s);
}

.upload-consent {
	display: flex;
	flex-direction: column;
	gap: var(--gap-s);
}


/* 	Footer
	===================================================*/

footer {
	padding: var(--gap-s) var(--gap-m);
	display: flex;
	gap: var(--gap-s);
	color: var(--foreground);
}

footer a {
	color: var(--foreground);
}

/* ======================================================
	StoryList
	===================================================*/

.list-item {
    height: 100px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
	background: oklch(from var(--background) calc(l + 0.1) c h / 0.4);
	border: 1px solid oklch(from var(--background) calc(l - 0.2) c h / 0.4);
	box-shadow: oklch(from var(--background) calc(l - 0.2) c h / 0.2) 0px 5px 10px;
	border-radius: var(--gap-s);
	padding: var(--gap-xs);
}
.list-item .list-image {
    height: 90%;
	aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 26px;
	border-radius: var(--gap-xs);
	cursor: pointer;
}
.story-list h3 {
    text-decoration: none;
    color: #000000;
    font-size: 20px;
    font-weight: 700;
	cursor: pointer;
}

.list-item .list-number {
    font-size: 20px;
	margin-left: 10px;
}

.list-item .list-buttons {
	margin-left: auto;
	display: flex;
	flex-wrap: nowrap;
}

/* ======================================================
	subpages
	===================================================*/
.subpage .section-header i a {
	font-size: 18px;
	text-decoration: none;
	font-weight: 700;
	color: var(--foreground);
}

.subpage article {
	width: 60%;
	margin: 0 20%;
}

.subpage article h2 {
	font-size: 20px;
	margin: 20px 0 10px;
}

.subpage article ul,
.subpage article ol {
	margin-left: 30px;
}

.subpage .section-header {
	padding: 20px 20%;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

/* ======================================================
	Editor
	===================================================*/
#device-blocker {
	display: none;
}

.device-blocker {
	position: fixed;
	inset: 0;
	background: var(--background);
	z-index: 9999;
	justify-content: center;
	align-items: center;
}

.device-blocker-content {
	padding: 2rem;
	max-width: 450px;
	text-align: center;
	opacity: 0.8;
}

.device-blocker-content h2 {
	margin: 0 0 1rem 0;
	font-size: 1.5rem;
}


/* vertical */

main.workspace {
	display: grid;
	grid-template-columns: clamp(80px, 20%, 140px) auto auto clamp(80px, 20%, 140px);
	grid-template-rows: auto auto auto auto;
}

.workspace .branch-navigation {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	grid-column: 2 / 4;
	grid-row: 1 / 2;
	gap: var(--gap-xs);
}

.workspace .branch-navigation h2 {
	width: min-content;
	white-space: nowrap;
}

.workspace .branch-navigation nav {
	display: flex;
	justify-content: center;
	gap: var(--gap-s);
	width: 100%;
	height: calc(var(--gap-s) * 1.5);
	margin-bottom: var(--gap-xs);
}

.workspace .branch-navigation nav .dropdown-parent {
	position: relative;
	z-index: 2;
}

.workspace aside {
	position: sticky;
	top: 20vh;
}

.workspace .tools {
	display: flex;
	flex-direction: column;
	justify-content: start;
	align-items: center;
	gap: var(--gap-s);
	grid-column: 1 / 2;
	grid-row: 2 / 4;
}

.workspace .scroll-navigation {
	display: flex;
	justify-content: center;
	align-items: start;
	grid-column: 4 / 5;
	grid-row: 2 / 4;
}

.workspace .tools .button-container,
.workspace .scroll-navigation .button-container {
	display: flex;
	flex-direction: column;
	gap: var(--gap-s);
  	width: fit-content;
}

.workspace .scroll-navigation .tile-nr {
	font-size: 20px;
  	line-height: 1;
	margin: auto;
}

/* horizontal */

.workspace.horizontal .branch-navigation {
	grid-column: 1 / 5;
}

.workspace.horizontal .tools {
	flex-direction: row;
	grid-column: 2 / 4;
	grid-row: 3 / 4;
	padding: var(--gap-xs) var(--gap-s);
	margin: var(--gap-xs) auto;
}

.workspace.horizontal .scroll-navigation {
	flex-direction: row;
	justify-content: center;
	grid-column: 2 / 4;
	grid-row: 4 / 5;
	padding: var(--gap-xs) var(--gap-s);
}

.workspace.horizontal .tools .button-container,
.workspace.horizontal .scroll-navigation .button-container {
	flex-direction: row;
  	box-sizing: content-box;
}

.workspace.horizontal .tools button,
.workspace.horizontal .scroll-navigation button {
	height: calc(24px + var(--gap-s));
}

.workspace.horizontal .scroll-navigation .button-start {
	transform: rotate(270deg);
}

.workspace.horizontal .scroll-navigation .button-end {
	transform: rotate(-90deg);
}

.horizontal .rotate-left {
	transform: rotate(90deg);
}

.branch-container.adding-elements .tile  {
	cursor: crosshair;
}

/* general */

button {
	cursor: pointer;
	color: var(--foreground);
}

button img {
	height: 100%;
}



.workspace .tools,
.workspace .scroll-navigation,
#modal-small {
	background: oklch(from var(--background) calc(l + 0.1) c h / 0.4);
	border: 1px solid oklch(from var(--background) calc(l - 0.2) c h / 0.4);
	box-shadow: oklch(from var(--background) calc(l - 0.2) c h / 0.2) 0px 5px 10px;
	border-radius: var(--gap-s);
	padding: var(--gap-xs);
	margin: 0 auto auto;
}

button.tool {
	padding: var(--gap-xs);
}

.workspace .branch-navigation button,
button.tool {
	border: none;
	background: transparent;
	aspect-ratio: 1 / 1;
}

.tool.deactivated {
	cursor: not-allowed;
	opacity: 0.25;
	display: none;
}
.tool.deactivated:hover {
	background: none;
}

/* branch navigation */

.workspace .branch-navigation #branch-name-container,
.workspace .branch-navigation>button {
	padding: var(--gap-xs);
}

.workspace .branch-navigation #branch-name-container,
.workspace .branch-navigation #branch-dropdown button {
	aspect-ratio: unset;
}
.workspace .branch-navigation #branch-name-container {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	min-width: 200px;
	gap: var(--gap-xs);
	anchor-name: --branch-dropdown;
}

.workspace #branch-dropdown {
	position: absolute;
	position-anchor: --branch-dropdown;
	top: anchor(bottom);
	left: anchor(left);
	width: anchor-size(--branch-dropdown width);
	background: var(--background);
	border: 1px solid oklch(from var(--background) calc(l - 0.2) c h);
	border-top: none;
	border-radius: var(--gap-s);
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	padding: var(--gap-xs);
}

.workspace #branch-list {
	display: flex;
	flex-direction: column;
	align-items: start;
	border-top-right-radius: 0;
}

.workspace #branch-list button,
.workspace #branch-dropdown input {
	padding: var(--gap-xs);
	font-size: 18px;
	border: none;
	background: transparent;
	width: 100%;
	text-align: left;
}

.workspace #branch-dropdown input {
	border-bottom: 1px solid oklch(from var(--background) calc(l - 0.2) c h);

}

.workspace .branch-navigation h2 {
	font-size: 32px;
	white-space: nowrap;
}

.workspace .branch-navigation h3 {
	font-size: 22px;
	white-space: nowrap;
	max-width: 30vw;
	overflow: hidden;
	text-overflow: ellipsis;
}

.workspace #branch-name-container>img {
	height: calc(var(--gap-s) * 1.5);
	width: min-content;
}

.workspace #button-settings {
	margin-right: auto;
}

.workspace #button-new-branch {
	margin-left: auto;
}

/* tools */
.workspace .tools .active-tool,
.modal .active {
	background: oklch(from var(--background) calc(l - 0.2) c h / 0.2);
	border-radius: var(--gap-xs);
}

.tool:hover {
	background: oklch(from var(--background) calc(l - 0.1) c h / 0.2);
	border-radius: var(--gap-xs);
}

/* story container */
.tile-edit-btn {
	position: absolute;
	top: calc(50% - 30px);;
	z-index: 9990;
	width: 28px;
	aspect-ratio: 1 / 2;
	border-radius: var(--gap-s);
	right: 0;
	background: oklch(from var(--background) calc(l + 0.1) c h);
	border: 1px solid oklch(from var(--background) calc(l - 0.4) c h);
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	display: flex;
	justify-content: center;
	align-items: center;
}

.tile-edit-btn img {
	height: 30px;
}

.tile-insert-btn {
	position: absolute;
	top: -15px;
	z-index: 9999;
	width: 30px;
	aspect-ratio: 1 / 1;
	border-radius: var(--gap-s);
	left: calc(50% - 15px);
	background: oklch(from var(--background) calc(l + 0.1) c h);
	border: 1px solid oklch(from var(--background) calc(l - 0.4) c h);
	font-size: 18px;
}

.tile-insert-btn.first {
	top: -5px;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
}

.tile-insert-btn.last {
	bottom: -5px;
	top: auto;
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.tile-placeholder {
	aspect-ratio: 1 / 1;
	width: 100%;
	height: 100%;
	max-height: 60vh;
	max-width: 95vw;
	background: oklch(from var(--background) calc(l - 0.2) c h);
	display: flex;
	position: relative;
	align-items: center;
	justify-content: center;
	color: var(--foreground);
	font-size: 22px;
	font-style: italic;
}

.creation-preview {
	position: absolute;

	border: 2px dashed var(--selected);
	background: oklch(from var(--background) l c h / 0.4);

	pointer-events: none;
	z-index: 2000;
}

/* Modal */

body.modal-open,
body.context-menu-open {
    overflow: hidden;
}

.modal {
	background: var(--background);
	border: 1px solid oklch(from var(--background) calc(l - 0.4) c h);
	margin: auto;
	border-radius: var(--gap-xs);
	padding: var(--gap-s);
}

#modal-large {
	width: calc(100% - (2 * var(--gap-m)));
	height: calc(100% - (2 * var(--gap-s)));
	padding: var(--gap-s) var(--gap-m);
}

#modal-medium {
	width: min(calc(100% - (2 * var(--gap-m))), 800px);
	height: min(calc(100% - (2 * var(--gap-m))), 500px);
}

.modal-header {
	display: flex;
	justify-content: space-between;
	padding-bottom: var(--gap-s);
	position: relative;
	z-index: 20;
}

#modal-medium .modal-header {
	padding-bottom: var(--gap-xs);
}

.modal h2{
	font-size: 30px;
}

.modal h3 {
	padding-top: var(--gap-xs);
	font-size: 26px;
	font-weight: 400;
}

.modal label {
	display: block;
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 5px;
}

.modal-header button {
	height: var(--gap-m);
	width: var(--gap-m);
	border: none;
	background: transparent;
}

#modal-medium .modal-header button {
	height: var(--gap-s);
	width: var(--gap-s);
}

.modal-body.dual-body {
	display: flex;
	gap: var(--gap-s);
}

.dual-body nav {
	flex-grow: 1;
	border-right: 1px solid var(--foreground);
	max-width: 250px;
}

.dual-body nav ul li {
	list-style-type: none;
}

.dual-body .modal-content {
	flex-grow: 2;
	max-width: 750px;
}

.modal-content .input-container {
	padding: var(--gap-xs) 0;
	width: 100%;
}

.modal-content input,
.modal-content button:not(.tool),
.modal-content select,
.modal-content textarea,
.tiles-modal .aspect-ratio-group,
.tiles-modal .custom-file-input {
	font-size: 18px;
	background: oklch(from var(--background) calc(l + 0.1) c h);
	border: 1px solid oklch(from var(--background) calc(l - 0.4) c h);
	padding: calc(var(--gap-xs) / 2) var(--gap-xs);
	border-radius: var(--gap-xs);
}

.modal-content input[type="checkbox"] {
	width: var(--gap-s);
	aspect-ratio: 1 / 1;
}

.modal-content .input-checkbox,
.modal-content .input-danger {
	display: flex;
	gap: var(--gap-xs);
}

.modal-content .input-danger {
	justify-content: space-between;
}

.danger-zone {
	border: 2px solid var(--danger);
	margin-top: var(--gap-xs);
	padding: var(--gap-xs) var(--gap-s);
	border-radius: var(--gap-s);
}

.danger-zone button {
	color: var(--danger);
	border: 2px solid var(--danger);
	background: oklch(from var(--danger) l c h / 0.1 );
}

.modal nav label {
	margin-bottom: var(--gap-s);
}

.modal nav li {
	margin-top: var(--gap-xs);
}

.modal nav button {
	font-size: 18px;
	text-align: left;
	border: none;
	background: transparent;
	width: 100%;
	padding: calc(var(--gap-xs) / 2) var(--gap-xs);
	margin: 0 var(--gap-s) 0 -15px;
}

.modal.loading::before {
	content: "loading...";
	box-sizing: border-box;
	padding: 45vh 0;
	text-align: center;
	font-size: 28px;
	font-weight: 700;
	color: black;
	width: 100%;
	height: 100%;
	background: rgba(79, 79, 79, 0.4);
	display: block;
	position: absolute;
	left: 0;
	top: 0;
	z-index: 19;
}

/* modal medium */

#modal-medium h3 {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 6px;
	justify-content: center;
  	padding-bottom: var(--gap-xs);
}

#modal-medium h3>img {
	height: 26px;
	width: auto;
}

.modal .tiles-modal {
	display: flex;
	gap: var(--gap-s);
	height: 75%;
}

.modal .tiles-modal>div {
	width: 30%;
  	flex-grow: 1;
}

.modal .tile-content {
	width: 100%;
	margin: var(--gap-s) 0;
}

.modal .tile-content button {
	margin-top: var(--gap-m);
}

.tiles-modal .aspect-ratio-group {
	display: flex;
	justify-content: space-between;
}

.tiles-modal .aspect-ratio-group input {
	display: inline;
	width: 45%;
	background: none;
	border: none;
	padding: 0;
	border-radius: 0;
	text-align: center;
}

.tiles-modal .aspect-ratio-group input:focus {
	outline: none;
}

.tiles-modal .aspect-ratio-group  input::-webkit-outer-spin-button,
.tiles-modal .aspect-ratio-group  input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tiles-modal .aspect-ratio-group  input[type=number] {
    appearance:textfield;
}

.tiles-modal .aspect-ratio-group span {
	display: inline;
	width: 5%;
}

.tiles-modal #text-tile-content {
	height: 50%;
}

.tiles-modal #canvas-file {
	display: none;
}

.tiles-modal .custom-file-input {
	display: block;
	cursor: pointer;
	font-weight: normal;
	font-style: italic;
}

.modal-content.edit-object {
	height: 78%;
	display: flex;
	flex-direction: column;
	gap: var(--gap-s);
}



.modal-content.edit-object textarea {
	display: block;
	width: 100%;
	resize: none;
}

.modal-content.edit-object textarea:focus {
	outline: none;
}

.modal-content.edit-object #text-content,
.modal-content.edit-object #image-content {
	height: 65%;
}

.modal-content.edit-object #image-content {
	display: flex;
	justify-content: center;
	position: relative;
}

.modal-content.edit-object #image-content #image-file,
.modal-content.edit-object #image-content #story-file {
	display: none;
}

.modal-content.edit-object #image-content .upload-file {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	background: oklch(from var(--background) calc(l - 0.6) c h / 0.4);
	border-radius: var(--gap-xs);
	border: dashed 4px oklch(from var(--background) calc(l + 0.1) c h);
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	color: white;
	font-size: 28px;
	gap: var(--gap-xs);
}

.modal-content.edit-object #image-content .upload-file span,
.accepted-files {
	font-size: 16px;
	font-weight: 400;
	font-style: italic;
}

.modal-content.edit-object #image-content.open {
	height: 22%;
}

.modal-content.edit-object #image-content.open .upload-file span {
	display: none;
}

.modal-content.edit-object #image-content .edit-image {
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	z-index: 1;
}

.advanced-dropdown-container.open {
	min-height: 60%;
}

.advanced-dropdown-container button {
	margin-top: var(--gap-xs);
	border: none;
	outline: none;
	background: none;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
}

.advanced-dropdown-container button img {
	width: 24px;
	transition: transform 250ms;
}

.advanced-dropdown-container.open button img {
	transform: rotate(180deg);
	transition: transform 250ms;
}

.advanced-dropdown {
	display: none;
	height: 70%;
}

.advanced-dropdown-container.open .advanced-dropdown {
	display: block;
}

.advanced-dropdown #custom-css {
	height: 100%;
} 


/* modal small */

#modal-small {
	position: absolute;
  	position-anchor: --modal-small;
	position-area: span-all left;
	margin-right: var(--gap-xs);
	background: oklch(from var(--background) calc(l + 0.1) c h);
}

#modal-small::backdrop {
	opacity: 0;
}

.tiles-settings {
	display: flex;
	flex-direction: column;
	gap: var(--gap-xs);
}

/* Context Menu */

.context-menu {
	position: fixed;
	display: flex;
	flex-direction: column;
	gap: var(--gap-xs);
	background: oklch(from var(--background) calc(l + 0.1) c h);
	border: 1px solid oklch(from var(--background) calc(l - 0.2) c h / 0.4);
	border-radius: var(--gap-xs);
	padding: var(--gap-xs);
	z-index: 100000;
}

.context-menu button {
	display: flex;
	flex-wrap: nowrap;
	aspect-ratio: auto;
	height: var(--gap-s);
	font-size: 16px;
	gap: var(--gap-xs);
	align-items: center;
	justify-content: left;
	padding: calc(var(--gap-xs) / 2);
	box-sizing: content-box;
}

.context-menu button img {
	height: 100%;
}

/* 	Story
	===================================================*/

.workspace #story-container {
	box-shadow: oklch(from var(--background) calc(l - 0.2) c h / 0.4) 0px 5px 10px;
	border: 1px solid oklch(from var(--background) calc(l - 0.2) c h);
	border-radius: var(--gap-xs);
	height: fit-content;
	overflow: hidden;
	grid-column: 2 / 4;
	grid-row: 2 / 4;
}	

.workspace.horizontal #story-container {
	max-height: 55vh;
	--vertical-height: 55vh;
	grid-column: 1 / 5;
	grid-row: 2 / 3;
}

/* Objects */

.object {
	position: relative;
}


.object.selected,
.link.selected {
	user-select: none;
	anchor-name: --selected-object;
	cursor: move;
	z-index: 10000;
}

.object.selected {
	outline: 2px solid var(--selected);
	outline-offset: 0;
	position: relative;
}

.handle {
	position: absolute;
  	position-anchor: --selected-object;
	width: 12px;
	height: 12px;
	background: var(--background);
	border: 2px solid var(--selected);
	cursor: nwse-resize;
	z-index: 9999;
}

.handle-top-left {
	position-area: top left;
	translate: 6px 6px;
}
.handle-top-right {
	position-area: top right;
	translate: -6px 6px;
	cursor: nesw-resize;
}
.handle-bottom-left {
	position-area: bottom left;
	translate: 6px -6px;
	cursor: nesw-resize;
}
.handle-bottom-right {
	position-area: bottom right;
	translate: -6px -6px;
}

body.object-movement {
  user-select: none;
}

/* Links */
.workspace #story-container .link {
	/* pointer-events: none; */
	border: none;
	outline: 3px solid var(--success);
	box-shadow: var(--selected) 0 0 2px;
	outline-offset: 0;
	background: transparent;
	color: transparent;
	opacity: 1;
}

/* ======================================================
	Media Querries
	===================================================*/

@media screen and (max-width: 580px) {
	:root {
		
		--gap-m: clamp(20px, 2.5vh, 40px);
		--gap-s: calc(var(--gap-m) / 2);
		--gap-xs: calc(var(--gap-s) / 2);
	}

	header .logo h1, .section-header h2 {
		font-size: clamp(18px, 3vh, 36px);
	}

	header button, .section-header button {
		font-size: 16px;
		padding: var(--gap-xs) var(--gap-s);
	}

	header button img, .section-header button img {
		height: clamp(18px, 2.5vh, 30px);
	}

	.list-item {
		height: 70px;
	}

	.story-list h3 {
		font-size: 18px;
		text-wrap: nowrap;
		text-overflow: clip;
		overflow-x: hidden;
	}
	footer {
		flex-wrap: wrap;
	}
}
	

/* block small / touchscreens on editor */

@media (max-width: 950px) {
	#device-blocker {
		display: flex;
	}
}
