/*
Theme Name: SB Trail Classic
Theme URI: https://santabarbaratrailclassic.com/
Author: Stephen Searer
Description: Custom theme for the Santa Barbara Trail Classic.
Version: 0.4.0
Requires at least: 6.5
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sbtc
*/

:root {
	--sbtc-bg: #e4e5de;
	--sbtc-text: #1b1b1b;
	--sbtc-wrap: 1240px;
	--sbtc-pad: 20px;
	--sbtc-measure: 700px;
	--sbtc-link: #215732;
	--sbtc-link-hover: #18432c;
	--sbtc-button: var(--sbtc-link);
	--sbtc-button-hover: var(--sbtc-link-hover);
	--sbtc-font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--sbtc-bg);
	color: var(--sbtc-text);
	font-family: var(--sbtc-font);
	font-size: 1.125rem;
	font-weight: 400;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

a:hover,
a:focus-visible {
	text-decoration-thickness: 2px;
}

/* Content links: Forest Service green. Header site name stays inherit. */
.sbtc-entry a {
	color: var(--sbtc-link);
}

.sbtc-entry a:hover,
.sbtc-entry a:focus-visible {
	color: var(--sbtc-link-hover);
}

.sbtc-entry a:focus-visible {
	outline: 2px solid var(--sbtc-link-hover);
	outline-offset: 3px;
}

img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.skip-link:focus {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
	z-index: 100;
	width: auto;
	height: auto;
	padding: 0.5rem 0.75rem;
	clip: auto;
	background: var(--sbtc-text);
	color: var(--sbtc-bg);
	text-decoration: none;
}

/* Shared centered shell: 1240px incl. 20px side padding. */
.sbtc-main {
	max-width: var(--sbtc-wrap);
	margin-inline: auto;
	padding-inline: var(--sbtc-pad);
	box-sizing: border-box;
}

/* Header: site name in the same 700px measure as the text. */
.sbtc-header {
	padding-inline: var(--sbtc-pad);
}

.sbtc-header__inner {
	display: flex;
	align-items: center;
	box-sizing: border-box;
	max-width: var(--sbtc-measure);
	min-height: 3.25rem;
	margin-inline: auto;
	padding-block: 0.5rem;
	padding-inline: 0;
	border-bottom: 1px solid var(--sbtc-text);
}

.sbtc-header__name {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 500;
	line-height: 1.2;
}

.sbtc-header__name a {
	text-decoration: none;
}

.sbtc-header__name a:hover,
.sbtc-header__name a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.sbtc-main {
	padding-block: 1.5rem 3rem;
}

/* Classic editor content.

   Cap and center the reading measure on text elements, not the
   entry, so the 1200px heading image keeps the full content width.
   A left/right floated course map cannot sit in the 250px side
   space beside a centered 700px column, so those maps become
   blocks at the same measure. */
.sbtc-entry > :is(h1, h2, h3, h4, h5, h6, p, ul, ol, blockquote, table, figure, pre, dl, address, hr),
.sbtc-entry > .wp-caption {
	max-width: var(--sbtc-measure);
	margin-inline: auto;
}

.sbtc-entry > .sbtc-course-map.sbtc-course-map--align-right,
.sbtc-entry > .sbtc-course-map.sbtc-course-map--align-left {
	float: none;
	clear: both;
	width: 100%;
	max-width: var(--sbtc-measure);
	margin-inline: auto;
}

.sbtc-entry h1 {
	margin-block: 0 0.75em;
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	font-weight: 700;
	line-height: 1.2;
}

.sbtc-entry h2 {
	margin-block: 0 0.75em;
	font-size: clamp(1.5rem, 3.5vw, 2rem);
	font-weight: 700;
	line-height: 1.2;
}

.sbtc-entry h3 {
	margin-block: 0 0.6em;
	font-size: clamp(1.375rem, 3vw, 1.625rem);
	font-weight: 700;
	line-height: 1.25;
}

.sbtc-entry h4 {
	margin-block: 0 0.5em;
	font-size: clamp(1.25rem, 2.5vw, 1.375rem);
	font-weight: 700;
	line-height: 1.3;
}

.sbtc-entry h5 {
	margin-block: 0 0.5em;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.35;
}

.sbtc-entry h6 {
	margin-block: 0 0.5em;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.35;
}

.sbtc-entry p,
.sbtc-entry ul,
.sbtc-entry ol {
	margin-block: 0 1.25em;
}

.sbtc-entry ul,
.sbtc-entry ol {
	padding-left: 1.35em;
}

.sbtc-entry li + li {
	margin-top: 0.35em;
}

.sbtc-entry blockquote {
	margin-block: 0 1.25em;
	padding: 0.25em 0 0.25em 1.25em;
	border-left: 3px solid var(--sbtc-text);
	font-style: italic;
}

/* Horizontal rule: 1px solid text color, always inside the 700px measure. */
.sbtc-entry hr {
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: var(--sbtc-measure);
	height: 0;
	margin-block: 2em;
	margin-inline: auto;
	border: 0;
	border-top: 1px solid var(--sbtc-text);
	background: none;
}

.sbtc-entry .alignleft {
	float: left;
	margin: 0.25em 1.25em 1em 0;
}

.sbtc-entry .alignright {
	float: right;
	margin: 0.25em 0 1em 1.25em;
}

.sbtc-entry .aligncenter {
	display: block;
	margin: 0.5em auto 1.25em;
}

.sbtc-entry .wp-caption {
	max-width: min(100%, var(--sbtc-measure));
}

.sbtc-entry .wp-caption-text {
	margin: 0.4em 0 0;
	font-size: 0.875rem;
	line-height: 1.4;
}

/* Content photos: Wide 1200 breaks out of the 700px measure to the
   1200px content width (same as the hero). Column 700 stays in the
   text column. Both shrink to 100% of their container on small screens.
   `width: 100% !important` overrides the inline width WordPress puts
   on `.wp-caption`. */
.sbtc-entry > p:has(> img.size-sbtc_wide),
.sbtc-entry > p:has(> a > img.size-sbtc_wide),
.sbtc-entry > figure:has(img.size-sbtc_wide),
.sbtc-entry > .wp-caption:has(img.size-sbtc_wide) {
	max-width: 100%;
	width: 100%;
	margin-inline: auto;
}

.sbtc-entry .wp-caption:has(img.size-sbtc_wide) {
	width: 100% !important;
}

.sbtc-entry img.size-sbtc_wide {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin-inline: auto;
}

.sbtc-entry > p:has(> img.size-sbtc_column),
.sbtc-entry > p:has(> a > img.size-sbtc_column),
.sbtc-entry > figure:has(img.size-sbtc_column),
.sbtc-entry > .wp-caption:has(img.size-sbtc_column) {
	max-width: var(--sbtc-measure);
	width: 100%;
	margin-inline: auto;
}

.sbtc-entry .wp-caption:has(img.size-sbtc_column) {
	width: 100% !important;
	max-width: min(100%, var(--sbtc-measure));
}

.sbtc-entry img.size-sbtc_column {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin-inline: auto;
}

.sbtc-entry::after {
	content: "";
	display: table;
	clear: both;
}

/* Styled link button (Classic Editor "Button" control). */
.sbtc-entry a.sbtc-button {
	display: inline-block;
	padding: 0.7em 1.25em;
	border-radius: 6px;
	background: var(--sbtc-button);
	color: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-underline-offset: unset;
	text-decoration-thickness: 0;
}

.sbtc-entry a.sbtc-button:hover,
.sbtc-entry a.sbtc-button:focus,
.sbtc-entry a.sbtc-button:focus-visible {
	background: var(--sbtc-button-hover);
	color: #fff;
	text-decoration: none;
	text-decoration-thickness: 0;
}

.sbtc-entry a.sbtc-button:focus-visible {
	outline: 2px solid var(--sbtc-button-hover);
	outline-offset: 3px;
}

.sbtc-entry p:has(> a.sbtc-button:only-child) {
	line-height: 1;
}

/* Compact pill for in-sentence links (Formats → Link pill). */
.sbtc-entry a.sbtc-link-pill,
.sbtc-entry a.sbtc-link-pill:visited {
	display: inline-block;
	margin: 4px 0;
	padding: 4px 18px;
	border-radius: 6px;
	background: var(--sbtc-link);
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	text-decoration: none;
	text-underline-offset: unset;
	text-decoration-thickness: 0;
}

.sbtc-entry a.sbtc-link-pill:hover,
.sbtc-entry a.sbtc-link-pill:focus,
.sbtc-entry a.sbtc-link-pill:focus-visible,
.sbtc-entry a.sbtc-link-pill:visited:hover,
.sbtc-entry a.sbtc-link-pill:visited:focus-visible {
	background: var(--sbtc-link-hover);
	color: #fff;
	text-decoration: none;
	text-decoration-thickness: 0;
}

.sbtc-entry a.sbtc-link-pill:focus-visible {
	outline: 2px solid var(--sbtc-link-hover);
	outline-offset: 3px;
}

/* Page heading image (featured image). Omitted entirely when none is set. */
.sbtc-hero {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 1200 / 500;
	object-fit: cover;
	object-position: center;
	margin: 0 0 1.5rem;
}

@media (max-width: 767px) {
	:root {
		--sbtc-pad: 10px;
	}

	.sbtc-main {
		padding-block: 1.25rem 2.5rem;
	}

	.sbtc-entry .alignleft,
	.sbtc-entry .alignright {
		float: none;
		display: block;
		margin: 0.5em auto 1.25em;
	}

}
