/*
 * Mobile-friendly layer for Magazine Basic.
 * Loaded after style.css. Desktop layout (above 960px) is left as it was,
 * apart from the overflow safeguards at the top of this file.
 */

/* =Safeguards (all screen sizes)
-------------------------------------------------------------- */
html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

.entry-content img,
.entry-content video,
.entry-content iframe,
.entry-content embed,
.entry-content object,
.widget img,
.wp-caption {
	max-width: 100%;
}

.entry-content img,
.widget img {
	height: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
	outline: 3px solid #fecc02;
	outline-offset: 2px;
}

/* =Tablet and below: single column
-------------------------------------------------------------- */
@media (max-width: 960px) {
	#primary.c9,
	#primary.c8,
	#secondary.c3,
	#secondary.c4 {
		width: 100%;
		float: none !important;
	}

	#secondary {
		margin-top: 8px;
		padding-top: 24px;
		border-top: 1px solid #e3e6ea;
	}
}

/* =Phones and small tablets
-------------------------------------------------------------- */
@media (max-width: 768px) {
	html {
		scroll-padding-top: 68px;
	}

	body {
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
		font-size: 17px;
		line-height: 1.7;
		color: #2b3138;
	}

	/* The tiled, fixed photo background is hidden behind the full-width page
	   on phones and makes scrolling stutter, so it is switched off here. */
	body.custom-background {
		background-image: none !important;
		background-color: #ffffff;
	}

	.grid {
		min-width: 0;
	}

	.c1, .c2, .c3, .c4, .c5, .c6, .c7, .c8, .c9, .c10, .c11, .c12 {
		padding-left: 18px;
		padding-right: 18px;
	}

	#header .c12 {
		padding-left: 0;
		padding-right: 0;
	}

	/* --- Fixed top bar with menu and search buttons --- */
	#header {
		padding-top: 56px;
	}

	#mobile-menu {
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 1000;
		height: 56px;
		padding: 4px 8px;
		background: #1f2933;
		border-bottom: 3px solid #fecc02;
		text-align: left;
	}

	#mobile-menu a,
	#mobile-menu a.left-menu {
		float: none;
		width: 48px;
		height: 48px;
		line-height: 48px;
		margin: 0;
		font-size: 22px;
		color: #ffffff;
		text-shadow: none;
		background: transparent;
		box-shadow: none;
		border-radius: 10px;
	}

	#mobile-menu a:hover,
	#mobile-menu a:active {
		background: rgba(255, 255, 255, 0.14);
	}

	.admin-bar #mobile-menu {
		top: 46px;
	}

	/* --- Search panel --- */
	#drop-down-search {
		position: fixed;
		top: 56px;
		left: 0;
		right: 0;
		z-index: 999;
		padding: 12px 16px;
		background: #1f2933;
		box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
	}

	.admin-bar #drop-down-search {
		top: 102px;
	}

	#drop-down-search .search-form {
		padding-right: 0;
	}

	#drop-down-search label {
		display: block;
	}

	#drop-down-search .search-field {
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
		width: 100%;
		height: 46px;
		padding: 0 14px;
		font-size: 16px;
		border: 0;
		border-radius: 8px;
		-webkit-appearance: none;
		appearance: none;
	}

	/* --- Slide-down navigation --- */
	#nav-wrapper {
		position: fixed;
		top: 56px;
		left: 0;
		right: 0;
		width: auto;
		max-height: calc(100vh - 56px);
		max-height: calc(100dvh - 56px);
		overflow-y: auto;
		overscroll-behavior: contain;
		z-index: 998;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
	}

	.admin-bar #nav-wrapper {
		top: 102px;
		max-height: calc(100vh - 102px);
	}

	#nav-wrapper .nav-content {
		padding-bottom: 0;
	}

	#nav-wrapper .menus {
		font-family: inherit;
		background: #263340;
	}

	#nav-wrapper .menus li a {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		min-height: 50px;
		padding: 12px 18px !important;
		font-size: 16px;
		line-height: 1.35;
		color: #ffffff !important;
		text-shadow: none;
		background: #263340;
		border-top: 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.09);
	}

	#nav-wrapper .menus li a:hover,
	#nav-wrapper .menus li a:active {
		background: #31414f;
	}

	#nav-wrapper .menus li.current-menu-item > a {
		box-shadow: inset 4px 0 0 #fecc02;
	}

	#nav-wrapper .menus li a:not(:last-child):after {
		float: none;
		flex: none;
		margin: 0;
		transition: transform 0.2s ease;
	}

	#nav-wrapper .menus li a.open:not(:last-child):after {
		transform: rotate(180deg);
	}

	#nav-wrapper .menus ul ul {
		background: #1b252f;
	}

	#nav-wrapper .menus ul ul li a {
		padding-left: 34px !important;
		font-size: 15px;
		background: #1b252f;
	}

	#nav-wrapper .menus ul ul ul li a {
		padding-left: 50px !important;
	}

	/* --- Site title --- */
	.title-logo-wrapper {
		float: none;
		width: 100%;
	}

	#site-title {
		margin: 22px 0 8px;
		padding: 0 18px;
		font-size: 34px;
		font-size: clamp(28px, 8.5vw, 40px);
		line-height: 1.1;
	}

	#site-description {
		padding: 0 18px;
		font-size: 16px;
		line-height: 1.4;
	}

	.header-group {
		margin-bottom: 20px;
	}

	#site-logo {
		padding: 20px 18px 0;
	}

	/* --- Content --- */
	#main {
		padding-top: 4px;
	}

	.entry-title {
		font-size: 28px;
		font-size: clamp(25px, 7vw, 32px);
		line-height: 1.2;
		margin: 0 0 0.6em;
	}

	.entry-content {
		-webkit-hyphens: auto;
		hyphens: auto;
		overflow-wrap: break-word;
	}

	.entry-content p {
		margin: 0 0 1.15em;
	}

	.entry-content h1 { font-size: 26px; }
	.entry-content h2 { font-size: 23px; }
	.entry-content h3 { font-size: 20px; }
	.entry-content h4 { font-size: 18px; }

	.entry-content h1,
	.entry-content h2,
	.entry-content h3,
	.entry-content h4 {
		line-height: 1.3;
		margin: 1.6em 0 0.5em;
	}

	.entry-content a {
		text-decoration: underline;
		text-underline-offset: 2px;
	}

	.entry-content ul,
	.entry-content ol {
		padding-left: 1.3em;
	}

	.entry-content li {
		margin-bottom: 0.4em;
	}

	.entry-content table {
		display: block;
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.entry-content pre {
		overflow-x: auto;
	}

	.entry-content .wp-caption {
		height: auto;
	}

	.entry-meta {
		font-size: 14px;
		line-height: 1.5;
	}

	/* --- Forms: 16px text stops iOS zooming in on focus --- */
	input,
	textarea,
	select {
		font-size: 16px;
	}

	input[type=text],
	input[type=password],
	input[type=email],
	input[type=url],
	input[type=number],
	input[type=tel],
	textarea {
		width: 100%;
	}

	input[type="submit"],
	button {
		min-height: 46px;
		padding-left: 18px;
		padding-right: 18px;
	}

	select {
		height: 44px;
		line-height: normal;
	}

	.widget select {
		width: calc(100% - 40px);
	}

	/* --- Sidebar, now below the content --- */
	#secondary .widget {
		margin-bottom: 28px;
	}

	#secondary .widget-title {
		font-size: 21px;
		line-height: 1.3;
	}

	#secondary .wp-block-latest-posts__list {
		text-align: left;
		padding: 0 !important;
		margin: 0;
		font-size: 16px !important;
	}

	#secondary .wp-block-latest-posts__list li {
		padding: 16px 0;
		border-bottom: 1px solid #e3e6ea;
	}

	#secondary .wp-block-latest-posts__list li:last-child {
		border-bottom: 0;
	}

	#secondary .wp-block-latest-posts__post-title {
		display: block;
		font-size: 18px;
		font-weight: 700;
		line-height: 1.35;
		padding: 2px 0;
		text-decoration: none;
	}

	#secondary .wp-block-latest-posts__post-date {
		margin-top: 4px;
		font-size: 14px;
		color: #6b7480;
	}

	#secondary .wp-block-latest-posts__post-excerpt {
		margin: 6px 0 0;
		font-size: 16px;
		line-height: 1.6;
	}

	/* --- Pagination and comment links: comfortable tap targets --- */
	#pagination a,
	#pagination span,
	.page-numbers,
	.comment-reply-link {
		display: inline-block;
		min-width: 44px;
		min-height: 44px;
		line-height: 44px;
		text-align: center;
	}

	/* --- Footer: let it grow with its text --- */
	#page {
		margin-bottom: 0;
	}

	#footer {
		height: auto;
		padding: 22px 0 26px;
	}

	.copyright {
		margin: 0;
		font-size: 14px;
		line-height: 1.6;
	}

	.copyright span {
		padding: 2px 0;
	}
}

/* =Small phones
-------------------------------------------------------------- */
@media (max-width: 480px) {
	.entry-content .alignleft,
	.entry-content .alignright,
	.entry-content img.alignleft,
	.entry-content img.alignright {
		float: none;
		display: block;
		margin: 0 auto 1.1em;
	}

	.entry-content .wp-caption.alignleft,
	.entry-content .wp-caption.alignright {
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	#nav-wrapper .menus li a:not(:last-child):after {
		transition: none;
	}
}
