/*
 * Mobile fixes (phones, under 768px).
 * Loaded after css/style.css. Kept separate so the compiled SCSS
 * (CodeKit + Susy) does not need to be rebuilt.
 */
@media (max-width: 767px) {

	/* 1. Side padding. On phones the grid columns have no padding but
	   rows keep their -10px margins, so text and images ran to (and past)
	   the screen edges. Give the page a 15px gutter and flatten rows. */
	.container,
	.main-content {
		padding-left: 15px;
		padding-right: 15px;
	}
	.row {
		margin-left: 0;
		margin-right: 0;
	}
	[class*="col-"] {
		padding-left: 0;
		padding-right: 0;
	}

	/* 2. Nothing wider than the screen. */
	.main-content img,
	.main-content iframe,
	.main-content video {
		max-width: 100%;
		height: auto;
	}
	.catalogs__item > p img {
		max-width: 80%;
	}
	.ink__main-img {
		width: 100%;
	}

	/* Wide price tables scroll sideways inside their box
	   instead of pushing the whole page wider. */
	.addon__table,
	.main-content table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* 3. Homepage splash title was too large and right-aligned,
	   so "SCREEN" was cut off. */
	.splash {
		left: 0;
	}
	.splash h1 {
		text-align: center;
		font-size: 2.4rem;
		line-height: 1.2;
	}

	/* 4. Tighter vertical spacing between sections. */
	.section__title {
		margin-top: 3rem;
		margin-bottom: 2rem;
	}
	.catalogs__item {
		margin-bottom: 3rem;
		padding-bottom: 3rem;
	}
	.templates__item {
		padding-bottom: 3rem;
	}

	/* Long words/URLs and email addresses wrap instead of overflowing. */
	.entry,
	.entry p,
	.contact h2,
	.contact h3 {
		overflow-wrap: anywhere;
	}

	/* ------------------------------------------------------------
	   Shorter pages: swipeable rows and tighter grids
	   ------------------------------------------------------------ */

	/* Shared swipe row: one row that scrolls sideways and snaps to each
	   item. It bleeds to the screen edges so the next item peeks in. */
	.samples__wrap,
	.catalogs__examples,
	.templates.row {
		display: flex;
		flex-wrap: nowrap;
		gap: 12px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		scroll-padding-left: 15px;
		-webkit-overflow-scrolling: touch;
		margin-left: -15px !important;
		margin-right: -15px !important;
		padding: 0 15px 12px !important;
	}
	/* The theme's clearfix pseudo-elements would become empty slides. */
	.samples__wrap:before,
	.samples__wrap:after,
	.catalogs__examples:before,
	.catalogs__examples:after,
	.templates.row:before,
	.templates.row:after {
		display: none !important;
	}
	/* "Swipe" hint under the section/brand. */
	.samples .section__title:after,
	.section.templates > .section__title:after,
	.catalogs__item .catalogs__link:after {
		content: "Swipe for more \2192";
		display: block;
		margin-top: .6rem;
		font-size: 1.1rem;
		font-weight: normal;
		letter-spacing: 1px;
		color: #777;
	}

	/* Samples (T-shirts and Flatstock pages). */
	.samples__sample {
		flex: 0 0 78%;
		width: 78%;
		margin: 0 !important;
		scroll-snap-align: start;
	}
	/* Show the title under each photo (there's no hover on phones). */
	.samples__sample figcaption {
		position: static;
		opacity: 1;
		visibility: visible;
		background: none;
		padding: .6rem 0 0;
	}
	.samples__sample figcaption .centered {
		position: static;
		transform: none;
		width: auto;
	}
	.samples__sample figure {
		margin: 0;
	}

	/* Catalog garments: one swipe row per brand. */
	.catalogs__examples > li {
		flex: 0 0 42%;
		width: 42%;
		float: none;
		padding: 0;
		scroll-snap-align: start;
	}
	.catalogs__examples button {
		padding: 0;
		width: 100%;
	}
	.catalogs__example--blowup {
		display: none !important;
	}
	.catalogs__item .entry {
		margin-bottom: 1.5rem;
	}

	/* Templates: one swipe row, like the samples. */
	.templates__item {
		flex: 0 0 42%;
		width: 42%;
		float: none;
		padding: 0 0 1rem;
		scroll-snap-align: start;
	}
	.templates__item h4 {
		font-size: 1.3rem;
	}

	/* Ink choices: the two example photos side by side. */
	.ink__choice [id^="ink_"] > .row {
		display: flex;
		gap: 10px;
	}
	.ink__choice [id^="ink_"] > .row:before,
	.ink__choice [id^="ink_"] > .row:after {
		display: none;
	}
	.ink__choice [id^="ink_"] .popup {
		flex: 1 1 0;
		width: auto;
		float: none;
		min-width: 0;
	}
	.ink__choice {
		margin-bottom: 3rem;
	}

	/* Info page: FAQ, Internship and Terms collapse into tap-to-open
	   sections (classes are added by js/mobile.js). */
	.m-collapsible {
		margin-top: 0 !important;
		padding-top: 0 !important;
		border-top: 0 !important;
	}
	:not(.m-collapsible) + .m-collapsible {
		margin-top: 4rem !important;
	}
	.m-collapsible:not(.m-collapsed) {
		padding-bottom: 2rem;
	}
	.m-collapsible > .section__title {
		cursor: pointer;
		margin: 0;
		padding: 1.8rem 3rem 1.8rem 0;
		border-top: 1px solid #000;
		text-align: left;
		position: relative;
		-webkit-tap-highlight-color: transparent;
	}
	.m-collapsible > .section__title:after {
		content: "+";
		position: absolute;
		right: 0;
		top: 50%;
		transform: translateY(-50%);
		font-size: 2.4rem;
		font-weight: normal;
		line-height: 1;
	}
	.m-collapsible:not(.m-collapsed) > .section__title:after {
		content: "\2212";
	}
	.m-collapsible:not(.m-collapsed) > .section__title {
		margin-bottom: 2rem;
	}
	.m-collapsed > :not(.section__title) {
		display: none !important;
	}
	/* Last collapsible gets a closing rule so the list looks finished. */
	#terms.m-collapsible {
		border-bottom: 1px solid #000;
	}
}
