/* Laid out as iCloud Drive is on the web: a bar on top, places on the left,
   the folder's contents as icons or a list, and a look at a file over it. */
:root {
	color-scheme: light dark;
	--ink: #1d1d1f;
	--soft: #6e6e73;
	--line: #e3e3e8;
	--ground: #ffffff;
	--side: #f5f5f7;
	--raised: #ffffff;
	--accent: #0071e3;
	--chosen: #e4f0fd;
	--folder: #5fb4f6;
	--folder-tab: #3d9cea;
	--paper: #f0f0f3;
	--paper-line: #c9c9d1;
}
@media (prefers-color-scheme: dark) {
	:root {
		--ink: #f5f5f7;
		--soft: #a1a1a6;
		--line: #38383d;
		--ground: #1d1d1f;
		--side: #161617;
		--raised: #2a2a2d;
		--accent: #2997ff;
		--chosen: #17395c;
		--folder: #4aa3ec;
		--folder-tab: #2f86d2;
		--paper: #3a3a3f;
		--paper-line: #5c5c63;
	}
}
[hidden] {
	display: none !important;
}
* {
	box-sizing: border-box;
}
html,
body {
	height: 100%;
}
body {
	margin: 0;
	background: var(--ground);
	color: var(--ink);
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
}
button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}
button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}
.grow {
	flex: 1;
}
.note {
	color: var(--soft);
}
.mark {
	fill: var(--accent);
}

/* signing in */
#signin {
	min-height: 100%;
	display: grid;
	place-items: center;
	padding: 1.5rem 1rem;
	background: var(--side);
}
#connect {
	width: min(100%, 26rem);
	display: grid;
	gap: 0.875rem;
	padding: 2rem;
	background: var(--raised);
	border: 1px solid var(--line);
	border-radius: 1.125rem;
	text-align: center;
}
#connect .mark {
	width: 4rem;
	justify-self: center;
}
#connect h1 {
	margin: 0;
	font-size: 1.75rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}
#connect p {
	margin: 0;
}
#connect label {
	display: grid;
	gap: 0.3rem;
	text-align: left;
	font-size: 0.8125rem;
	color: var(--soft);
}
#connect input,
#connect textarea {
	color: var(--ink);
	background: var(--ground);
	border: 1px solid var(--line);
	border-radius: 0.625rem;
	padding: 0.6rem 0.75rem;
	width: 100%;
	resize: vertical;
}
#connect textarea {
	font-family: ui-monospace, monospace;
	font-size: 0.8125rem;
}
#byhand {
	text-align: left;
	font-size: 0.875rem;
}
#byhand summary {
	color: var(--accent);
	cursor: pointer;
}
#byhand[open] {
	display: grid;
	gap: 0.75rem;
}
.primary {
	color: #fff;
	background: var(--accent);
	border-radius: 0.625rem;
	padding: 0.65rem 1rem;
	font-weight: 500;
}
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* the drive */
#drive {
	height: 100%;
	display: grid;
	grid-template: auto 1fr / 14rem 1fr;
}
#drive > header {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.625rem 1rem;
	border-bottom: 1px solid var(--line);
}
#drive > header .mark,
#home > header .mark {
	width: 1.75rem;
}
#drive > header strong,
#home > header strong {
	font-size: 1.0625rem;
	font-weight: 600;
}
#go-home {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	border-radius: 0.5rem;
}

/* home: what there is to open, as tiles */
#home {
	min-height: 100%;
	background: var(--side);
}
#home > header {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.625rem 1rem;
}
#tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 14rem));
	justify-content: center;
	gap: 1rem;
	padding: 3rem 1rem;
	max-width: 64rem;
	margin: 0 auto;
}
.tile {
	display: grid;
	justify-items: start;
	gap: 0.25rem;
	padding: 1.25rem;
	background: var(--raised);
	border: 1px solid var(--line);
	border-radius: 1.125rem;
	text-align: left;
	transition: transform 0.12s;
}
.tile:hover {
	transform: translateY(-2px);
}
.tile svg {
	width: 3.5rem;
	margin-bottom: 0.75rem;
}
.tile strong {
	font-size: 1.125rem;
	font-weight: 600;
}
.tile span {
	font-size: 0.8125rem;
	color: var(--soft);
}
.tile-photo {
	fill: #9ad0f5;
}
.tile-sun {
	fill: #ffd60a;
}
.tile-hill {
	fill: #34c759;
}
.tile-face {
	fill: var(--paper);
	stroke: var(--paper-line);
	stroke-width: 2;
}
.tile-hands,
.tile-lid {
	fill: none;
	stroke: var(--soft);
	stroke-width: 3.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.tile-bin {
	fill: var(--paper);
	stroke: var(--soft);
	stroke-width: 3;
	stroke-linejoin: round;
}
#lock,
#home-lock,
#upload,
#putback,
#download,
#look header button {
	color: var(--accent);
	padding: 0.3rem 0.7rem;
	border-radius: 0.5rem;
}
#lock:hover,
#home-lock:hover,
#upload:hover,
#putback:hover:enabled,
#download:hover:enabled,
#look header button:hover {
	background: var(--chosen);
}
#putback:disabled,
#download:disabled {
	color: var(--soft);
	cursor: default;
}
#sidebar {
	background: var(--side);
	border-right: 1px solid var(--line);
	padding: 0.75rem 0.5rem;
	overflow-y: auto;
}
#sidebar h2 {
	margin: 0.75rem 0.6rem 0.3rem;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--soft);
}
#sidebar button {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.4rem 0.6rem;
	border-radius: 0.5rem;
	text-align: left;
	overflow: hidden;
}
#sidebar button span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
#sidebar button svg {
	width: 1.125rem;
	flex: none;
}
svg.line {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
#sidebar button:hover {
	background: var(--line);
}
#sidebar button[aria-current="true"] {
	background: var(--accent);
	color: #fff;
}
#main {
	display: grid;
	grid-template-rows: auto 1fr auto;
	min-width: 0;
	min-height: 0;
}
#toolbar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0.625rem 1rem;
	border-bottom: 1px solid var(--line);
}
#path {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	font-size: 1.0625rem;
	font-weight: 600;
}
#path button {
	color: var(--soft);
	font-weight: 500;
}
#path button:hover {
	color: var(--accent);
}
#path button::after {
	content: "›";
	margin-left: 0.25rem;
	color: var(--soft);
}
#filter,
#sort {
	background: var(--side);
	border: 1px solid var(--line);
	border-radius: 0.5rem;
	padding: 0.3rem 0.6rem;
}
#filter {
	width: 11rem;
}
.toggle {
	display: flex;
	border: 1px solid var(--line);
	border-radius: 0.5rem;
	overflow: hidden;
}
.toggle button {
	padding: 0.35rem 0.55rem;
	display: grid;
}
.toggle svg {
	width: 1rem;
	fill: var(--soft);
}
.toggle button[aria-pressed="true"] {
	background: var(--line);
}
.toggle button[aria-pressed="true"] svg {
	fill: var(--ink);
}
#items {
	overflow-y: auto;
	padding: 1rem;
	outline: none;
}
#items.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
	gap: 0.5rem;
	align-content: start;
}
.item {
	border-radius: 0.625rem;
	text-align: center;
	cursor: default;
	user-select: none;
}
.grid .item {
	display: grid;
	justify-items: center;
	gap: 0.3rem;
	padding: 0.6rem 0.4rem;
}
.item .art {
	width: 4.5rem;
	height: 4.5rem;
	display: grid;
	place-items: center;
}
.item .art svg {
	width: 100%;
	height: 100%;
}
.item .art img {
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 0.375rem;
	box-shadow: 0 0 0 1px var(--line);
}
/* pictures: bigger, and without their names */
#items.photos {
	grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
	gap: 0.25rem;
}
.photos .item {
	padding: 0.2rem;
}
.photos .item .art {
	width: 100%;
	height: auto;
	aspect-ratio: 1;
}
.photos .item .name,
.photos .item .detail {
	display: none;
}
.item .name {
	overflow-wrap: anywhere;
	line-height: 1.25;
	font-size: 0.8125rem;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}
.item .detail {
	font-size: 0.75rem;
	color: var(--soft);
}
/* sent from here, not yet taken in by a computer */
.item.pending {
	opacity: 0.55;
}
#items.dropping {
	outline: 2px dashed var(--accent);
	outline-offset: -0.5rem;
}
.item[aria-selected="true"] {
	background: var(--chosen);
}
.list .item {
	display: grid;
	grid-template-columns: 2rem minmax(0, 1fr) 9rem 6rem;
	align-items: center;
	gap: 0.75rem;
	padding: 0.35rem 0.6rem;
	text-align: left;
	border-bottom: 1px solid var(--line);
	border-radius: 0;
}
.list .item .art {
	width: 2rem;
	height: 2rem;
}
.list .item .name {
	font-size: 0.875rem;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}
.list .item .detail {
	text-align: right;
	font-variant-numeric: tabular-nums;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.empty {
	grid-column: 1 / -1;
	padding: 3rem 1rem;
	text-align: center;
	color: var(--soft);
}
#status {
	padding: 0.4rem 1rem;
	border-top: 1px solid var(--line);
	font-size: 0.75rem;
	color: var(--soft);
	min-height: 1.9rem;
}
/* icons: a folder, and a sheet of paper with its kind */
.folder-back {
	fill: var(--folder-tab);
}
.folder-front {
	fill: var(--folder);
}
.sheet {
	fill: var(--paper);
	stroke: var(--paper-line);
}
.sheet-kind {
	fill: var(--soft);
	font: 600 9px system-ui, sans-serif;
	text-anchor: middle;
}

/* a look at one file */
#look {
	width: min(96vw, 64rem);
	height: min(92vh, 48rem);
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 0.875rem;
	background: var(--raised);
	color: var(--ink);
	overflow: hidden;
}
#look[open] {
	display: grid;
	grid-template-rows: auto 1fr;
}
#look::backdrop {
	background: rgb(0 0 0 / 0.45);
}
#look header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem 0.5rem 1rem;
	border-bottom: 1px solid var(--line);
}
#look-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
#look-body {
	display: grid;
	place-items: center;
	min-height: 0;
	overflow: auto;
	background: var(--side);
}
#look-body img,
#look-body video {
	max-width: 100%;
	max-height: 100%;
}
#look-body iframe {
	width: 100%;
	height: 100%;
	border: 0;
}
#look-body pre {
	margin: 0;
	padding: 1rem;
	width: 100%;
	height: 100%;
	overflow: auto;
	font: 0.8125rem/1.5 ui-monospace, monospace;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: var(--ground);
}
#look-body .none {
	display: grid;
	justify-items: center;
	gap: 0.5rem;
	color: var(--soft);
}
#look-body .none .art {
	width: 6rem;
	height: 6rem;
}

@media (max-width: 640px) {
	#drive {
		grid-template: auto auto 1fr / 1fr;
	}
	#sidebar {
		display: flex;
		gap: 0.25rem;
		overflow-x: auto;
		border-right: 0;
		border-bottom: 1px solid var(--line);
		padding: 0.4rem 0.5rem;
	}
	#sidebar h2 {
		display: none;
	}
	#sidebar button {
		width: auto;
		flex: none;
	}
	#filter {
		flex: 1;
		width: auto;
		min-width: 6rem;
	}
	.list .item {
		grid-template-columns: 2rem minmax(0, 1fr) 5rem;
	}
	.list .item .when {
		display: none;
	}
}
