@charset "ISO-8859-1";

/* =========================
   Base
   ========================= */

body {
	font-family: var(--font-family);
	font-size: var(--base-font-size);
	color: var(--color);
	height: 100dvh;
	margin: 0;
	overflow: hidden;
	overscroll-behavior: none;
	display: flex;
	flex-direction: column;
}


/* =========================
   Startup veil
   ========================= */

#veil {
	position: fixed;
	width: var(--width);
	height: 100dvh;
	background-color: var(--background-color);
	border: 1vh solid var(--dark-highlight);
	box-sizing: border-box;
	z-index: 5;

	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: none;
}

#veil-liner {
	position: relative;

	width: 100%;
	min-height: 100%;

	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 1vh;

	box-sizing: border-box;
}

#veil .hideable {
	display: none;
}

#veil.init {
	padding-top: 20vh;
}

#veil-outer {
	position: fixed;

	width: 100dvw;
	height: 100dvh;

	background-color: white;
	z-index: 6;
}


/* =========================
   Splash
   ========================= */

#splash {
	width: min(90%, 400px);
	display: grid;
}

#splash img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: 50% 0;
}


/* =========================
   Progress
   ========================= */

#progress {
	width: min(90%, 500px);
	height: calc(8px + max(3vh, var(--large-font-size)));

	display: flex;
	flex-direction: column;

	box-sizing: border-box;
	margin-top: var(--splash-slack);
}

#progress span {
	width: 100%;
	height: 2vh;

	display: flex;
	align-items: center;
	justify-content: center;

	margin-top: .5vh;

	color: black;
}

#progress button {
	width: min(33%, 150px);
	height: 100%;

	display: flex;
	align-items: center;
	justify-content: center;

	visibility: hidden;

	margin: 0 auto;
	padding-bottom: .3vh;

	box-sizing: border-box;

	border: 3px solid var(--dark-highlight);
	background-color: var(--dark-highlight);
	color: white;

	font-size: max(3vh, var(--large-font-size));
}

#progress button:hover {
	font-weight: bold;
	color: var(--background-color);
}

#progress button:active {
	color: var(--dark-highlight);
	background-color: var(--background-color);
}


/* =========================
   Ellipse/logo area
   ========================= */

#ellipse {
	width: 300px;

	margin-top: auto;
	margin-bottom: 1vh;

	justify-content: center;
	align-items: center;
}

#ellipse img {
	width: 100%;
	height: 100%;

	padding-top: .4vmin;

	object-fit: contain;
}


/* =========================
   Main scroll area
   ========================= */

#all {
	position: relative;

	width: var(--width);
	min-width: 300px;
	min-height: 0;

	flex: 1 1 auto;

	margin: 0 auto;

	background-color: var(--background-color);

	box-sizing: border-box;

	overflow-y: auto;
	overflow-x: hidden;

	overscroll-behavior: none;

	scrollbar-color:
		var(--dark-highlight)
		var(--light-highlight);
}

:fullscreen #all {
	width: var(--fullscreen-width);
	background-color: var(--background-color);
}

#liner {
	position: relative;

	width: 100%;

	box-sizing: border-box;
}


/* =========================
   Menus
   ========================= */

#menu-wrapper {
	width: 100%;

	display: flex;
	justify-content: center;
	align-items: center;
}

#menus {
	width: 100%;
	max-width: var(--preferredWidth);

	display: flex;
	align-items: stretch;
	justify-content: center;

	gap: 5px;
	padding-bottom: 2px;

	box-sizing: border-box;

	background-color: var(--background-color);
}

#menus > button,
#menus > .menu-group {
	flex: 1 1 0;
}

#menus button,
#menus > .menu-group > button {
	width: 100%;

	box-sizing: border-box;

	border: 2px solid var(--dark-highlight);

	background-color: var(--dark-highlight);
	color: white;

	font-size: 1em;

	white-space: nowrap;
}

#menus button.design {
	background-color: black;
	border-color: black;
}

#menus button:not(:disabled):hover {
	font-weight: bold;
	color: var(--background-color);
}

#menus button:not(:disabled):active {
	color: var(--dark-highlight);
	background-color: var(--background-color);
}


/* =========================
   Veil header / titles
   ========================= */

#veil-header {
	margin-top: 2vh;
	margin-bottom: 2vh;
}

#title {
	margin: 20px 0 0;

	text-align: center;

	font-size: var(--header-font-size);
	font-weight: bold;
}

#veil-title {
	margin: 0;

	text-align: center;

	font-size: max(3.5vh, var(--header-font-size));
	font-weight: bold;

	color: var(--dark-highlight);
}

#author {
	margin: 0;

	text-align: center;

	font-size: var(--large-font-size);
	font-weight: bold;
}

#veil-author {
	margin: 0;

	text-align: center;

	font-size: max(3vh, var(--large-font-size));
	font-weight: bold;

	color: var(--dark-highlight);
}

#description {
	padding: 15px;
}


/* =========================
   Puzzle tray
   ========================= */

#puzzle-tray {
	width: 100%;
	position: relative;
	z-index: 2;

	display: grid;

	gap: 0;

	background-color: var(--background-color);

	border-top: 0 solid transparent;
	border-bottom: 0 solid transparent;
}

#puzzle-tray img {
	display: block;

	max-width: 100%;
	height: auto;

	box-sizing: border-box;

	pointer-events: none;

	border-top: var(--image-border);
	border-bottom: var(--image-border);
}


/* =========================
   Audio groups
   ========================= */

#puzzle-tray .audio-sortable {
	position: relative;

	width: 100%;

	display: flex;
	flex-direction: column;

	gap: 0;
}

#puzzle-tray .audio-sortable > .clip {
	margin: 0;
}

#puzzle-tray .audio-sortable > .clip + .clip {
	border-top-width: 0;
	position: relative;
}


/* =========================
   Clip
   ========================= */

#puzzle-tray .clip {
	position: relative;

	width: 100%;
	height: 54px;
	border-top: 4px solid transparent;

	display: flex;
	align-items: stretch;

	box-sizing: border-box;

	overflow: visible;

	line-height: normal;

	color: var(--dark-highlight);

	background-color: var(--light-highlight);
}

#puzzle-tray > .audio-sortable > .clip:not(:first-child) {
    height: 54px;
    border-top-width: 4px;
    border-top-color: transparent;
}

#puzzle-tray > .audio-sortable:first-child > .clip:first-child {
    height: 50px;
    border-top-width: 0;
}


/* =========================
   Clip label
   ========================= */

.clip-label {
	flex: 0 0 50px;
	z-index: 1;

	width: 50px;
	height: 50px;
	/*align-self: stretch;*/

	display: flex;
	align-items: center;
	justify-content: center;

	box-sizing: border-box;

	background-color: var(--dark-highlight);
	color: white;

	font-size: 30px;
	line-height: 1;

	font-kerning: none;
	text-rendering: geometricPrecision;

	cursor: default;

	touch-action: none;

	-webkit-user-select: none;
	user-select: none;
}

.clip-label.lastMove {
	color: black;
	font-weight: bold;
}

/*#puzzle-tray > .audio-sortable > .clip:not(:first-child) .clip-label::before {*/

*#puzzle-tray > .audio-sortable > .clip .clip-label::before {
	
	content: "";
	position: absolute;

	left: 0;
	top: -4px;

	width: 50px;
	height: 4px;

	background-color: var(--dark-highlight);
}


/* =========================
   Clip progress
   ========================= */

.clip-progress {
	position: relative;

	flex: 1 1 auto;

	overflow: hidden;

	background: var(--light-highlight);

	touch-action: none;
}

#color-controls .clip-progress {
	background: var(--progress-background);
	background-size: var(--progress-size);
}


/* =========================
   Clip selection display
   ========================= */

.clip-selection {
	position: absolute;

	top: 0;
	bottom: 0;

	display: none;

	overflow: hidden;
}

.clip.selected .clip-selection {
	display: block;
}

.clip-pattern {
	position: absolute;
	inset: 0;
	background: var(--progress-background);
	background-size: var(--progress-size);
	background-repeat: repeat;
	background-position-y: top;
}

.clip-fill {
	position: absolute;

	inset: 0;

	background: var(--light-highlight);

	transform-origin: left center;
	transform: scaleX(0);
}

#color-controls .clip-fill {
	transform: scaleX(50%);
}


/* =========================
   Color controls
   ========================= */

#color-controls .scheme {
	width: 100%;
	height: 50px;

	display: flex;

	margin-top: 4px;
	margin-bottom: 4px;

	box-sizing: border-box;
}

#color-controls .scheme .dark-highlight,
#color-controls .scheme .light-highlight,
#color-controls .scheme .background {
	flex: 1;
}

#color-controls .scheme .dark-highlight {
	background-color: var(--dark-highlight);
}

#color-controls .scheme .light-highlight {
	background-color: var(--light-highlight);
}

#color-controls .scheme .background {
	background-color: var(--background-color);
}


/* =========================
   Clip buttons
   ========================= */

.clip-button button {
	height: 80%;

	font-size: .7em;
}

/* =========================
   Drag / SortableJS states
   ========================= */

#puzzle-tray .image-sortable {
	position: relative;

	width: 100%;
	height: 100%;

	box-sizing: border-box;

	background-color: transparent;
}

#puzzle-tray .image-sortable:not(.dragging) img.expose {
	pointer-events: auto;
}

#puzzle-tray .cover {
	position: absolute;

	top: 0;
	left: 0;

	width: 100%;
	height: 99%;

	z-index: 2;

	background-color: transparent;

	-webkit-user-select: none;
	user-select: none;

	-webkit-touch-callout: none;
}

#puzzle-tray .cover.expose {
	display: none;
}

#puzzle-tray .ghost img,
#puzzle-tray .ghost .clip {
	opacity: 0;
}


/* =========================
   Chosen / dragging states
   ========================= */

#puzzle-tray.highlight .image-sortable.chosen:not(.dragging) {
	height: 0;

	background-color: var(--gap-color-2);

	border-top-width: calc(var(--highlight-width) / 2);
	border-bottom-width: calc(var(--highlight-width) / 2);

	border-style: dashed;
	border-color: var(--gap-color-1);
}

#puzzle-tray.highlight .chosen img {
	position: absolute;

	transform: translate(0, -50%);

	border-color: transparent;
	border-style: solid;

	border-left-width: var(--image-indent);
	border-right-width: var(--image-indent);

	z-index: 1;
}

#puzzle-tray .image-sortable.chosen.dragging {
	background-color: transparent;

	border-width: 0;

	opacity: 1 !important;
}


/* =========================
   Classification / submenu
   ========================= */

.menu-group {
	position: relative;
}

.submenu {
	display: none;

	position: absolute;

	top: calc(100% + 2px);
	left: 0;

	min-width: 100%;
	width: max-content;

	z-index: 1000;

	background: var(--dark-highlight);

	border: 1px solid white;
	border-radius: 4px;

	overflow: hidden;
}

.menu-group.open .submenu {
	display: block;
}

.submenu button {
	display: block;

	width: 100%;

	box-sizing: border-box;

	padding: .5em .75em;

	border: none;

	background: transparent;

	color: white;

	text-align: left;

	cursor: pointer;

	white-space: nowrap;
}

.submenu button:hover {
	background: var(--light-highlight);
}

.help-group .submenu {
    left: auto;
    right: 0;
}


/* =========================
   Tray layout / gutters
   ========================= */

#tray-layout {
	width: 100%;

	display: flex;

	align-items: stretch;
}

#puzzle-tray {
	flex: 1 1 auto;

	min-width: 0;
}

#scroll-gutter {
	flex: 0 0 12px;
}

#group-gutter {
	position: relative;

	flex: 0 0 50px;

	background-color: var(--dark-highlight);
	padding: 0;
	border: 0;
	margin: 0;
}

#group-gutter .group-gap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);

    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    background: transparent;
    border: 0;
    box-sizing: border-box;
    margin: 0;
    appearance: none;

    z-index: 2;
}

#group-gutter .group-gap {
	position: absolute;

	left: 50%;
	transform: translateX(-50%);

	width: 32px;
	height: 32px;

	display: flex;
	align-items: center;
	justify-content: center;

	padding: 0;
	margin: 0;
	border: 0;

	z-index: 2;
}

/*
#group-gutter .group-gap:not(.inside-group)::before {
	content: "";

	position: absolute;

	top: 50%;
	right: 100%;

	width: 100dvw;              // Make this longer than the clip width
	height: 4px;

	background: white;

	transform: translateY(-50%);

	z-index: -1;
}
*/



#group-gutter .group-gap span {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: white;
    color: var(--dark-highlight);

    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

#group-gutter .group-gap.inside-group span {
    width: 24px;
    height: 24px;
}

/* =========================
   Clip separators
   ========================= */

#puzzle-tray .audio-sortable > .clip + .clip::before {
	content: "";

	position: absolute;

	left: 50px;
	right: -25px;

	top: -4px;

	height: 4px;
	
	background: transparent;

/*
	background-image: repeating-linear-gradient(
		to right,
		white 0,
		white 6px,
		transparent 6px,
		transparent 10px
	);
*/

	z-index: 2;
}

#puzzle-tray .audio-sortable + .audio-sortable {
	position: relative;
}

#tray-connectors {
    position: absolute;
    top: 0;
    left: 0;

    height: 100%;

    pointer-events: none;
    z-index: 3;
}

#tray-connectors .group-connector {
    position: absolute;

    left: 0;

    height: 4px;
    width: 100%;

    background: white;
}

#tray-connectors .group-connector.inside-group {
    display: none;
}



/* =========================
   Tutorial
   ========================= */
   
#help-video {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: black;

    display: flex;
    justify-content: center;
    align-items: center;
}

#help-video.hide {
    display: none;
}

#help-video-container {
    position: relative;
    height: 100%;
    aspect-ratio: 9 / 16;
    max-width: 100%;
}

#help-video-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#help-video-close {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 1;

    width: 40px;
    height: 40px;

    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .7);
    color: white;
    font-size: 30px;
    line-height: 30px;
    cursor: pointer;
}


/* =========================
   Demo
   ========================= */
   
html.demo-mode,
html.demo-mode * {
    cursor: none !important;
}

#touchIndicator {
    position: fixed;
    pointer-events: none;
    z-index: 999999;
    display: none;
    width: 24px;
 	height: 24px;
 	transform: rotate(22.5deg);
}

html.demo-mode #touchIndicator {
	display: block;
}

html.demo-mode #all {
    width: 450px;
    height: 800px;
    flex: none;
}

html.demo-mode #menus {
    width: 450px;
    max-width: none;
}

html.demo-mode #veil {
    width: 450px;
    height: 800px;
}