/* Phone and small-tablet layout. The desktop page is a fixed 868px wide, so
   below 900px it is restacked into one readable column. Colours come from the
   theme stylesheets loaded after this one. */

@media (max-width: 899px) {
	html {
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	.homepage .page-container {
		display: flex;
		flex-direction: column;
		width: auto;
		margin: 0;
		padding: 12px 12px 1em;
		box-sizing: border-box;
	}

	/* Let the left bar's pieces be placed individually around the categories. */
	#leftbar {
		display: contents;
	}

	#logo { order: 1; margin: 0 0 4px; }
	#postlks { order: 2; }
	.ms-player { order: 3; }
	#search { order: 4; }
	#topban { order: 5; }
	#center { order: 6; }
	#leftbar > div:has(#calban) { order: 7; }
	.ms-top8 { order: 8; }
	#rightbar { order: 9; }
	#user_resources { order: 10; }
	#about_craigslist { order: 11; }

	#logo {
		font-size: 34px;
		text-align: center;
	}

	#postlks {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 4px 16px;
		margin: 0 0 14px;
		font-size: 16px;
	}

	#postlks li {
		margin: 0;
	}

	.ms-player {
		margin: 0 0 14px;
		font-size: 13px;
	}

	#search {
		text-align: center;
		margin-bottom: 14px;
	}

	#search #inputForm {
		width: 100%;
		box-sizing: border-box;
		font-size: 18px;
	}

	#topban {
		float: none;
		margin: 0 0 14px;
		width: auto;
		text-align: center;
	}

	/* Categories */
	.homepage #center {
		float: none;
		width: auto;
		margin: 0;
	}

	.homepage .community,
	.homepage .housing,
	.homepage .jobs {
		float: none;
		width: auto;
		padding: 0;
	}

	.homepage #center .ban {
		margin: 0 0 6px;
		font-size: 19px;
		line-height: 1.6;
	}

	.homepage .cats {
		display: flex;
		gap: 0 14px;
		margin-bottom: 14px;
	}

	.homepage .col ul,
	.homepage .col ul + ul,
	.homepage .col ul + ul + ul {
		float: none;
		flex: 1;
		min-width: 0;
		padding: 0;
		font-size: 16px;
		line-height: 1.3;
	}

	.homepage #forums ul {
		width: auto;
		font-size: 15px;
	}

	/* A section with a single list flows it into two columns. */
	.homepage .col ul:only-child {
		columns: 2;
		column-gap: 14px;
	}

	.homepage .col ul li {
		break-inside: avoid;
	}

	.homepage .col ul li a {
		padding: 7px 0;
	}

	/* Calendar */
	#leftbar > div:has(#calban) {
		margin: 4px 0 14px;
		font-size: 15px;
	}

	#calban {
		font-size: 18px;
		text-align: center;
	}

	.cal {
		width: 100%;
		max-width: 420px;
		margin: 0 auto;
	}

	.cal td,
	.cal th {
		padding: 8px 0;
	}

	.ms-top8 {
		margin: 0 0 14px;
	}

	.ms-top8-title {
		font-size: 15px;
	}

	.ms-friend-name {
		font-size: 11px;
	}

	/* Languages and cities wrap as rows of links */
	.homepage #rightbar {
		float: none;
		width: auto;
		margin: 0 0 14px;
		padding: 10px;
		font-size: 15px;
		line-height: 1.6;
		min-height: 0;
		box-sizing: border-box;
		border-width: 1px;
		border-style: solid;
	}

	.homepage #rightbar #langlinks {
		padding: 0 0 8px;
		font-size: 15px;
	}

	#langlinks br {
		display: none;
	}

	#langlinks a,
	#langlinks b {
		display: inline-block;
		margin: 2px 6px;
	}

	.homepage #rightbar ul.menu,
	.homepage #rightbar ul.menu ul {
		margin: 0;
		text-align: center;
	}

	.homepage #rightbar ul.menu li.s {
		display: inline-block;
		margin: 2px 6px;
	}

	.homepage #rightbar h5 {
		font-size: 16px;
	}

	.homepage #rightbar .more {
		margin: 8px 0 0;
	}

	/* Help and about links */
	#user_resources,
	#about_craigslist {
		margin: 0 0 14px;
		font-size: 16px;
		line-height: 2;
		text-align: center;
	}

	footer .clfooter li {
		display: inline-block;
		padding: 4px 6px;
		font-size: 14px;
	}
}

/* Touch phones type into the search dock, so the in-page box is redundant. */
@media (max-width: 899px) and (hover: none) and (pointer: coarse) {
	#search {
		display: none;
	}
}

/* Tablets and larger phones in landscape: three category columns again. */
@media (min-width: 600px) and (max-width: 899px) {
	.homepage #center {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 0 16px;
	}

	.homepage .col ul:only-child {
		columns: 1;
	}
}
