/*
Theme Name: The Monochrome Collective
Theme URI: https://www.themonochromecollective.co
Author: Darren Pellegrino
Description: Block theme for The Monochrome Collective. Typography and colour measured from the Squarespace site it replaces - Archivo Black headings, Archivo body, #363636 on white. Typography is set in Styles, not hardcoded.
Version: 1.64.0
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: tmc
*/

/* ==================================================================
   Nearly everything lives in theme.json, which is what makes it
   editable from the Styles panel. Only rules the editor cannot
   express belong here.
   ================================================================== */

/* Underlines.

   The live site shows no underline on links, which theme.json now sets
   globally - so it is adjustable from Styles rather than fixed here.

   Focus is the exception. Removing the underline everywhere would
   leave a keyboard user with nothing to follow, so focus restores it
   and adds an outline. That is not a style preference; without it the
   site is unusable without a mouse. */

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  text-decoration: underline;
}

/* The navigation is uppercase Archivo Black and reads as a set of
   labels rather than prose, so it does not take the hover underline
   the body copy does. */

.wp-block-navigation a:hover {
  text-decoration: none;
  opacity: 0.6;
}

/* ---------------------------------------------------------------------------
   Foto app — custom social icon

   WordPress core has no "Foto" social service, so add a Social Icon set to
   "Link" (service: chain) pointing at the.fotoapp.co and this restyles it.

   The glyph is applied as a MASK rather than a background image: the file
   contributes shape only and the colour comes from currentColor, so the icon
   follows whatever colour and icon-size you set on the Social Icons block
   instead of being fixed here. Sizing in em does the same for size.
   --------------------------------------------------------------------------- */
.wp-social-link-chain a[href*="fotoapp.co"] svg {
	display: none;
}

.wp-social-link-chain a[href*="fotoapp.co"]::after {
	content: "";
	display: block;
	width: 1em;
	height: 1em;
	background-color: currentColor;
	-webkit-mask: url("assets/icons/foto.png") no-repeat center / contain;
	        mask: url("assets/icons/foto.png") no-repeat center / contain;
}

/* ---------------------------------------------------------------------------
   Tutor LMS - course pages in black and white

   Tutor ships a blue/green/orange palette through CSS custom properties. These
   remap every one of them onto the theme's own colours, so course pages match
   the rest of the site without touching Tutor's templates (which would break on
   plugin updates).

   Colours come from theme.json presets, so changing the palette in Styles
   changes these too.
   --------------------------------------------------------------------------- */
:root {
	/* how many columns the "What you'll learn" grid uses - 3 or 4 both work */
	--tmc-benefits-columns: 3;
}

.tutor-wrap,
.tutor-course-details-page,
body.tutor-lms,
body[class*="courses-"] {
	--tutor-color-primary:        var(--wp--preset--color--contrast, #363636);
	--tutor-color-primary-hover:  var(--wp--preset--color--ink, #000000);
	--tutor-color-secondary:      var(--wp--preset--color--contrast, #363636);
	--tutor-color-success:        var(--wp--preset--color--contrast, #363636);
	--tutor-color-warning:        var(--wp--preset--color--muted, #767676);
	--tutor-color-danger:         var(--wp--preset--color--contrast, #363636);
	--tutor-body-color:           var(--wp--preset--color--contrast, #363636);
	--tutor-color-subdued:        var(--wp--preset--color--muted, #767676);
	--tutor-color-hints:          var(--wp--preset--color--muted, #767676);
	--tutor-color-muted:          var(--wp--preset--color--muted, #767676);
	--tutor-border-color:         var(--wp--preset--color--rule, #E0E0E0);
	--tutor-color-gray:           var(--wp--preset--color--rule, #E0E0E0);
	--tutor-color-gray-10:        var(--wp--preset--color--subtle, #F5F5F5);
	--tutor-color-white:          var(--wp--preset--color--base, #FFFFFF);
}

/* Typography to match the rest of the site. Tutor sets its own sizes, which is
   why the course title was 24px against 45px everywhere else. */
.tutor-course-details-page h1,
.tutor-course-details-header h1 {
	font-size: var(--wp--preset--font-size--xx-large, 2.8rem);
	line-height: 1.2;
}

.tutor-course-details-page h2,
.tutor-course-details-page h3 {
	font-size: var(--wp--preset--font-size--x-large, 1.4rem);
	line-height: 1.2;
}

.tutor-course-details-page h4,
.tutor-course-topic-title h4 {
	font-size: var(--wp--preset--font-size--large, 1.1rem);
	line-height: 1.2;
}

/* "What you'll learn" as a grid.

   Tutor renders this as .tutor-course-details-widget-list - a flex list whose
   column count comes from a widget-col-N class on the parent (it ships as 2).
   Overriding to grid gives control of the count from one variable. */
.tutor-course-details-widget-list {
	display: grid !important;
	grid-template-columns: repeat(var(--tmc-benefits-columns, 3), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--40, 1.25rem) var(--wp--preset--spacing--50, 2rem);
	list-style: none;
	margin: 0;
	padding: 0;
}

.tutor-course-details-widget-list > li {
	width: auto !important;
	max-width: none !important;
	flex: none !important;
	margin: 0 !important;
}

/* Square corners and monochrome buttons, matching the site's own. */
.tutor-btn,
.tutor-btn-primary,
.tutor-course-details-page .tutor-btn {
	border-radius: 0;
	text-transform: uppercase;
	letter-spacing: inherit;
}

/* Course page: remove Tutor furniture that does not belong on a one-course site.

   The category chip ("Uncategorized") and the Share link both live in
   .tutor-course-details-top, so hiding that row clears both. The thumbnail
   block is hidden because the course has no featured image and Tutor renders a
   grey placeholder in its place. */
.tutor-course-details-top,
.tutor-course-thumbnail,
.tutor-course-details-instructors {
	display: none !important;
}

/* Tutor's own header block sits above the content; give it the site's spacing
   rather than the plugin's. */
.tutor-course-details-header {
	margin-bottom: var(--wp--preset--spacing--50, 2rem) !important;
}

/* Align Tutor's containers with the rest of the site.

   Tutor centres its content in a 1320px .tutor-container with 12px padding, so
   course content started 60px from the viewport edge while the header, footer
   and every other page start at 40px (the theme.json root padding). The result
   was a visible step between the header and the content beneath it.

   Using the root padding variables means this follows the site's own spacing
   rather than repeating a number.

   To use a DIFFERENT padding on course pages than the rest of the site, set
   --tmc-course-padding in Site Editor > Styles > (three dots) > Additional CSS:

       :root { --tmc-course-padding: 80px; }

   Any CSS length works, including a responsive one:

       :root { --tmc-course-padding: clamp(1.25rem, 5vw, 5rem); }

   Setting a custom property this way needs no !important and no extra
   selector weight, so a later theme update cannot override it. Remove the
   line and course pages fall back to the site's root padding. */
.tutor-page-wrap,
.tutor-full-width-course-top {
	padding-left: var( --tmc-course-padding, var( --wp--style--root--padding-left, 40px ) );
	padding-right: var( --tmc-course-padding, var( --wp--style--root--padding-right, 40px ) );
}

.tutor-course-details-page.tutor-container,
.tutor-page-wrap .tutor-container {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

/* The header part is rendered inside Tutor's markup rather than the block
   canvas, so it picks up the root padding on the wrong element. Move it to the
   inner group to match every other page. */
.tutor-full-width-course-top > header.wp-block-template-part,
header.wp-block-template-part:has(+ .tutor-page-wrap) {
	padding-left: 0;
	padding-right: 0;
}

/* Footer width on Tutor pages.

   Rendered through block_template_part() inside Tutor's template, the footer
   part becomes the outer element itself rather than sitting inside a wrapper.
   Its children then inherit the 820px content size instead of the site's wide
   width, so the footer columns came out half width and centred (820px at
   x=310, against 1360px at x=40 everywhere else).

   The header does not need this - its inner group is already full width. */
body.single-courses footer.wp-block-group > *,
body.tutor-lms footer.wp-block-group > * {
	max-width: none;
}

/* Restore block layout rules on Tutor pages.

   WordPress emits the CSS for layout classes like
   .is-content-justification-space-between per block, during the page render.
   Tutor outputs the header and footer template parts after that pass, so the
   classes arrive with no rules behind them - justify-content computed as
   "normal" instead of "space-between", which left the navigation 27px short of
   the right edge instead of flush with it.

   These restate what core would have emitted, scoped to Tutor pages so normal
   pages keep using WordPress's own generated CSS. */
body.single-courses .is-content-justification-space-between,
body.tutor-lms .is-content-justification-space-between {
	justify-content: space-between;
}

body.single-courses .is-content-justification-right,
body.tutor-lms .is-content-justification-right {
	justify-content: flex-end;
}

body.single-courses .is-content-justification-center,
body.tutor-lms .is-content-justification-center {
	justify-content: center;
}

body.single-courses .is-content-justification-left,
body.tutor-lms .is-content-justification-left {
	justify-content: flex-start;
}

body.single-courses .is-nowrap,
body.tutor-lms .is-nowrap {
	flex-wrap: nowrap;
}

body.single-courses .is-vertical,
body.tutor-lms .is-vertical {
	flex-direction: column;
}

/* Stop Tutor faux-bolding Archivo Black.

   Archivo Black exists only at weight 400 - it is already the heavy cut. Tutor
   applies tutor-fw-bold (700) and tutor-fw-medium (500) to its headings, so the
   browser synthesises a bolder face on top of a black one, which reads as
   smeared rather than bold. The theme's own headings render at 400 correctly.

   Body text is left alone: Archivo is a variable font with real weights, so
   bold works properly there. */
body.single-courses :is( h1, h2, h3, h4, h5, h6 ),
body.tutor-lms :is( h1, h2, h3, h4, h5, h6 ),
body.single-courses .tutor-course-details-title,
body.tutor-lms .tutor-accordion-item-header {
	font-weight: 400 !important;
}

/* Buttons in Archivo Black, matching the source site.

   theme.json covers WordPress buttons (including the File block's Download).
   Tutor renders its own .tutor-btn outside that system, so it needs saying
   again here. Weight stays 400 - Archivo Black has no other cut. */
.tutor-btn,
.tutor-btn-primary,
.tutor-course-details-page .tutor-btn,
body.tutor-lms .tutor-btn {
	font-family: var(--wp--preset--font-family--display, "Archivo Black", sans-serif);
	font-weight: 400;
}

/* Course page: keep the content inside the site's margins.

   Tutor's .tutor-row uses negative side margins to create its column gutter,
   so the main column started at x=16 while the wrapper - and every other page,
   the camera guide included - starts at x=40. Zeroing the outer edges keeps
   the gutter between the main column and the sidebar intact while aligning
   both outer edges with the rest of the site. */
.tutor-course-details-page .tutor-row {
	margin-left: 0;
	margin-right: 0;
}

.tutor-course-details-page .tutor-row > [class*="tutor-col"]:first-child {
	padding-left: 0;
}

.tutor-course-details-page .tutor-row > [class*="tutor-col"]:last-child {
	padding-right: 0;
}


/* ---------------------------------------------------------------------------
   Blog post images

   The Squarespace import wrote bare <img> tags inside <p> elements: no
   <figure>, no wp-block-image class. Core's image styles are all scoped to
   those classes, so nothing constrained these images and they rendered at
   their intrinsic width (up to 1600px) inside an 820px text column, spilling
   past the right edge of the page. 29 of 40 sampled posts are affected.

   Constraining them to the column is what makes them line up with the text.
   --------------------------------------------------------------------------- */
.wp-block-post-content img {
	max-width: 100%;
	height: auto;
}

/* An image alone in its own paragraph is a figure in all but name. Treating it
   as block-level removes the inline baseline gap underneath it and lets it
   centre in the column. */
.wp-block-post-content p > img:only-child {
	display: block;
	margin-inline: auto;
}

/* Breathing room around those images, using the theme's own spacing scale. */
.wp-block-post-content p:has( > img:only-child ) {
	margin-block: var( --wp--preset--spacing--50, 1.5rem );
}


/* ---------------------------------------------------------------------------
   Ultimate Member forms

   UM styles its buttons in two stylesheets:

     um-styles.min.css     .um-button { padding:16px 20px !important;
                                        text-transform:none !important;
                                        border:none !important;
                                        border-radius:4px !important; ... }
     um-old-default.min.css .um input[type=submit].um-button { background:#3ba1da }

   Because UM marks padding, text-transform, border and border-radius as
   !important, matching them here is not optional - a plain declaration loses
   to an !important one no matter how specific the selector is. The background
   is NOT !important in UM, but it is marked here anyway so the whole rule
   behaves consistently if UM changes.

   Target values are measured from the theme's own .wp-block-button__link:
     background contrast   text base       Archivo Black 400
     0.8rem     square     0.9rem 1.8rem   uppercase

   Archivo Black exists only at weight 400, so the weight is pinned - anything
   heavier makes the browser synthesise a faux-bold.
   --------------------------------------------------------------------------- */
.um .um-button,
.um a.um-button,
.um input[type="submit"].um-button,
.um #um-submit-btn {
	background: var( --wp--preset--color--contrast ) !important;
	color: var( --wp--preset--color--base ) !important;
	font-family: var( --wp--preset--font-family--display ) !important;
	font-weight: 400 !important;
	font-size: var( --wp--preset--font-size--fine ) !important;
	line-height: 1.5 !important;
	text-transform: uppercase !important;
	letter-spacing: 0 !important;
	text-decoration: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0.9rem 1.8rem !important;
	height: auto !important;
	box-shadow: none !important;
}

.um .um-button:hover,
.um a.um-button:hover,
.um input[type="submit"].um-button:hover,
.um #um-submit-btn:hover {
	background: var( --wp--preset--color--ink ) !important;
	color: var( --wp--preset--color--base ) !important;
}

/* UM's secondary buttons - the "Login" and "Register" links under the form.
   Outlined rather than filled so they do not compete with the submit button. */
.um .um-button.um-alt,
.um a.um-button.um-alt,
.um input[type="submit"].um-button.um-alt {
	background: transparent !important;
	color: var( --wp--preset--color--contrast ) !important;
	border: 1px solid var( --wp--preset--color--rule ) !important;
}

.um .um-button.um-alt:hover,
.um a.um-button.um-alt:hover,
.um input[type="submit"].um-button.um-alt:hover {
	background: var( --wp--preset--color--contrast ) !important;
	color: var( --wp--preset--color--base ) !important;
	border-color: var( --wp--preset--color--contrast ) !important;
}


/* ---------------------------------------------------------------------------
   Free Resources cards (members area)

   The three cards hold unequal amounts of text: one title wraps to two lines,
   and only two of the three have a second line. In normal flow that puts the
   three Download buttons at three different heights.

   Making each card a vertical flex column and giving the button block
   margin-top:auto pushes every button to the bottom of its card, so they
   share a baseline no matter how the text above them falls. Scoped to
   .tmc-resource-card so no other columns on the site are affected.
   --------------------------------------------------------------------------- */
.wp-block-column.tmc-resource-card {
	display: flex;
	flex-direction: column;
}

.wp-block-column.tmc-resource-card > .wp-block-buttons {
	margin-top: auto;                                  /* push to the card floor */
	padding-top: var( --wp--preset--spacing--50 );     /* the gap the inline margin used to give */
}

/* The image must not stretch to fill the flex column. */
.wp-block-column.tmc-resource-card > figure.wp-block-image {
	flex: 0 0 auto;
}


/* ---------------------------------------------------------------------------
   UM forms: hide the secondary cross-link button

   Each UM form ships a second button pointing at the other form - Register
   carries a "Login" button, Login carries a "Register" one. Both pages
   already offer that route in their own copy:

     /join/   the card above the form has a Log In button
     /login/  the line below the form reads "Not a member yet? Join Free"

   So the in-form button is a duplicate sitting right next to the submit
   button, which is where it does the most harm - two buttons side by side,
   only one of which does what the page is for.

   Listed per form rather than as a blanket .um .um-alt rule, so UM's other
   screens (account, password reset) keep their secondary actions.
   --------------------------------------------------------------------------- */
.um.um-register .um-button.um-alt,
.um.um-login .um-button.um-alt {
	display: none !important;
}


/* ---------------------------------------------------------------------------
   Store product grid

   WooCommerce's product-image block asks for the "thumbnail" size, but these
   images have no woocommerce_thumbnail file generated, so it falls back to
   attachment-large and renders 1024x1024 originals in the grid.

   Rather than regenerate every thumbnail, the displayed size is capped here.
   Scoped to .wc-block-grid__product-image, which only appears in product
   grids - the single product page keeps its full-size image.

   To change the size, set --tmc-product-image-max in Site Editor > Styles >
   (three dots) > Additional CSS:

       :root { --tmc-product-image-max: 160px; }
   --------------------------------------------------------------------------- */
.wc-block-grid__product-image img {
	max-width: var( --tmc-product-image-max, 200px );
	height: auto;
	margin-inline: auto;
}

/* The image block is a link wrapper; centre it so the capped image sits under
   the middle of the tile rather than hugging the left edge. */
.wc-block-grid__product-image {
	display: block;
	text-align: center;
}

/* Single product title. The template renders it at the theme's default
   heading scale, which is heavy next to a small product image. Adjustable:

       :root { --tmc-product-title-size: 1.6rem; }
*/
.single-product .wp-block-post-title {
	font-size: var( --tmc-product-title-size, var( --wp--preset--font-size--x-large ) );
	line-height: 1.2;
}


/* ---------------------------------------------------------------------------
   Retailer buttons

   Rendered by tmc_retailer_buttons() in place of WooCommerce's add-to-cart
   button, on both the product page and the shop grid. An earlier attempt hid
   the button with a .product-type-external selector, which never matched:
   the block theme's single-product template does not carry that class.
   --------------------------------------------------------------------------- */
.tmc-retailer-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: var( --wp--preset--spacing--40 );
}

.tmc-retailer-buttons .wp-block-button__link {
	text-transform: uppercase;
	font-size: var( --wp--preset--font-size--fine );
}


/* ---------------------------------------------------------------------------
   Store grid: line the buttons up

   Each tile is image / title / price / button, and titles run from one line
   ("The Zone System") to three ("The Monochrome Collective Capture One Styles
   Pack"), so in normal flow every button lands at a different height.

   The fix is to let the title absorb the slack (flex: 1) rather than to
   bottom-align the button. Bottom-aligning looked right but was not:
   WooCommerce's button block reserves space beneath the button for a hidden
   "View cart" link, so anchoring on the block's bottom edge left the visible
   button sitting higher than a block without that link.

   WordPress's own block-gap margins differ between the two button block types,
   so those are zeroed and one uniform gap applied instead.
   --------------------------------------------------------------------------- */
.wc-block-product {
	display: flex;
	flex-direction: column;
}

.wc-block-product > .wc-block-grid__product-image {
	flex: 0 0 auto;
}

/* the title takes up whatever height the tile has spare */
.wc-block-product > .wp-block-post-title {
	flex: 1 1 auto;
}

.wc-block-product > .wc-block-components-product-button,
.wc-block-product > .tmc-retailer-buttons {
	margin-top: 0 !important;
	padding-top: 1.25rem;
}

.wc-block-product > .tmc-retailer-buttons {
	justify-content: center;
}

/* The retailer buttons sit 18px below the Add to cart buttons beside them.
   The cause is measured, not guessed: WooCommerce's Add to cart button carries
   a 16px bottom margin and is 2px taller than our anchor, and because the grid
   sizes every tile to the same height that difference cannot be absorbed
   anywhere - equalising the titles just moves it.

   So this is a visual nudge rather than a layout fix. transform is used
   deliberately: it shifts what you see without changing the box, so nothing
   below it moves. If WooCommerce changes that margin, adjust the number:

       :root { --tmc-retailer-button-offset: 18px; }
*/
.wc-block-product > .tmc-retailer-buttons {
	transform: translateY( calc( -1 * var( --tmc-retailer-button-offset, 18px ) ) );
}


/* ---------------------------------------------------------------------------
   Forminator

   Measured against the site's own buttons, Forminator's submit button was the
   only one off-brand anywhere: Archivo (body face) at weight 500, 2px corners,
   sentence case, on #333333. Core and WooCommerce buttons already render
   Archivo Black 400, square, uppercase.

   Its success message also ships a mint bar - background #BCEEE6 with an inset
   #067963 rule - which is the only colour on the site.

   Selectors are written without the per-form module id, so all six forms are
   covered; !important is needed because Forminator's own rules are generated
   per form at (1,4,0) specificity.
   --------------------------------------------------------------------------- */
.forminator-ui .forminator-button,
.forminator-ui .forminator-button-submit,
.forminator-ui button.forminator-button {
	background: var( --wp--preset--color--contrast ) !important;
	color: var( --wp--preset--color--base ) !important;
	font-family: var( --wp--preset--font-family--display ) !important;
	font-weight: 400 !important;
	font-size: var( --wp--preset--font-size--fine ) !important;
	text-transform: uppercase !important;
	letter-spacing: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	padding: 0.9rem 1.8rem !important;
	height: auto !important;
}

.forminator-ui .forminator-button:hover,
.forminator-ui .forminator-button-submit:hover {
	background: var( --wp--preset--color--ink ) !important;
	color: var( --wp--preset--color--base ) !important;
}

/* Success message: grey, matching the site rather than Forminator's mint. */
.forminator-ui .forminator-response-message.forminator-success {
	background-color: var( --wp--preset--color--subtle ) !important;
	box-shadow: inset 2px 0 0 0 var( --wp--preset--color--contrast ) !important;
	border-radius: 0 !important;
}

.forminator-ui .forminator-response-message.forminator-success,
.forminator-ui .forminator-response-message.forminator-success p {
	color: var( --wp--preset--color--contrast ) !important;
}

/* ---------------------------------------------------------------------------
   Square corners everywhere

   A catch-all so any button a plugin adds later inherits the house style
   rather than arriving with rounded corners.
   --------------------------------------------------------------------------- */
.wp-element-button,
.wp-block-button__link,
.wc-block-components-button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.forminator-button {
	border-radius: 0 !important;
}


/* ---------------------------------------------------------------------------
   Newsletter form in the footer

   The footer's first column is 462px wide and Forminator's fields fill it, so
   the signup form reads as wide as the article text above it. Capping the
   fields keeps the footer looking like a footer.

   Scoped to <footer>, so the same form used full width on a page is
   unaffected. Adjustable:

       :root { --tmc-footer-field-max: 260px; }
   --------------------------------------------------------------------------- */
footer .forminator-ui input[type="text"],
footer .forminator-ui input[type="email"],
footer .forminator-ui input[type="url"],
footer .forminator-ui input[type="tel"],
footer .forminator-ui textarea,
footer .forminator-ui select,
footer .forminator-ui .forminator-row,
footer .forminator-ui .forminator-field {
	max-width: var( --tmc-footer-field-max, 320px );
}


/* ---------------------------------------------------------------------------
   Footer height

   Measured at 516px, of which roughly 200 was whitespace before any content -
   a 96px top margin plus 64/40 padding - and 210 was the signup form.

   These trim the spacing to bring it to about 440px. Every value is a
   variable, so the footer can be tightened or loosened without another theme
   update:

       :root {
         --tmc-footer-space-above: 2rem;
         --tmc-footer-pad-top:     2rem;
         --tmc-footer-pad-bottom:  1.5rem;
         --tmc-footer-row-gap:     10px;
       }

   The form's labels are deliberately left in place. Its fields have no
   placeholder text, so hiding the labels would leave the inputs unlabelled
   for anyone using a screen reader.
   --------------------------------------------------------------------------- */
footer > .wp-block-group {
	margin-top: var( --tmc-footer-space-above, 2rem ) !important;
	padding-top: var( --tmc-footer-pad-top, 2rem ) !important;
	padding-bottom: var( --tmc-footer-pad-bottom, 1.5rem ) !important;
}

footer .forminator-ui .forminator-row {
	margin-bottom: var( --tmc-footer-row-gap, 10px ) !important;
}

footer .forminator-ui .forminator-label {
	margin-bottom: 2px !important;
	line-height: 1.2 !important;
}

footer .forminator-ui input[type="text"],
footer .forminator-ui input[type="email"] {
	padding: 6px 9px !important;
}


/* ---------------------------------------------------------------------------
   Course benefits list on mobile

   "What Will You Learn?" is a 3-column grid, which at 393px gives each phase
   title 92px to live in - the titles wrap into narrow ragged stacks.

   This has to live in the theme rather than Additional CSS: both declare the
   variable on :root, and the theme's stylesheet loads later, so a value set in
   Additional CSS can never win. Override --tmc-benefits-columns from Additional
   CSS with a more specific selector if a different count is wanted.
   --------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------
   Members: resource cards on a common baseline

   The three Free Resources cards do not hold the same amount of copy - two
   carry a one-line subtitle ("Reference Chart", "A Field Checklist") and the
   Street Photography Field Guide has none - so each Download button sat
   directly under its own text and the row of buttons stepped up and down.

   Making the column a flex column lets the buttons block take margin-top:auto
   and sit on the floor of the tallest card. The gap above it is padding, not
   margin: a margin here would be consumed by the auto and the buttons would
   press against the text. That is the same mistake that had to be undone on
   these cards once before.
   --------------------------------------------------------------------------- */
.page-id-1384 .wp-block-columns > .wp-block-column {
	display: flex;
	flex-direction: column;
	/* No height here. height:100% on a flex item whose parent has no definite
	   height stops it filling the row, which leaves no free space for the auto
	   margin below to absorb - it then resolves to zero and nothing moves.
	   align-self makes the stretch explicit instead of relying on the
	   container's default. */
	align-self: stretch;
}

.page-id-1384 .wp-block-columns {
	align-items: stretch;
}

.page-id-1384 .wp-block-columns > .wp-block-column > .wp-block-buttons {
	margin-top: auto !important;
	padding-top: var( --tmc-card-button-gap, 1.25rem );
}

/* Stacked on a phone, so there is no row to line up and the auto margin would
   only add dead space between a card and the next one. */
@media ( max-width: 781px ) {
	.page-id-1384 .wp-block-columns > .wp-block-column {
		display: block;
	}

	.page-id-1384 .wp-block-columns > .wp-block-column > .wp-block-buttons {
		margin-top: 0 !important;
	}
}

/* ---------------------------------------------------------------------------
   Single post layout

   The post used to be one 820px column. It is now the reading column plus a
   Keep Reading rail beside it.

   The wrapper is capped below the theme's 1400px wide size on purpose: at 70%
   of 1400 the reading column would be ~950px, a longer line than the 820px
   these posts were written and signed off at. 1180px puts it back to roughly
   820 while leaving a usable rail.
   --------------------------------------------------------------------------- */
/* Scoped to main and marked important on purpose. WordPress prints its own
   layout rule for alignwide children using a generated container class
   (.wp-container-core-group-is-layout-xxx > .alignwide), which is two classes
   and beat the single-class selector used here first time round - the cap was
   silently ignored and the layout stayed at the 1400px wide size. Measured at
   1440px: wrapper 1360, reading column 912, rail images 391. */
main .tmc-post-layout,
main .tmc-post-title {
	max-width: var( --tmc-post-layout-width, 1080px ) !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

/* The title sits above both columns rather than inside the reading one, so it
   has the full width to break over instead of being squeezed into part of it.
   Its left edge still lines up with the body text, and the rail starts level
   with the first line of the post rather than with the title. */
main .tmc-post-title {
	width: 100%;
}

/* Column widths as variables so the balance can be changed without a theme
   release. The inline flex-basis the Columns block writes has to be overridden
   for that to be possible. 1080px with a 24px gap puts the reading column back
   to ~818px, the measure these posts were written at. */
@media ( min-width: 782px ) {
	main .tmc-post-layout > .tmc-post-layout__main {
		flex-basis: var( --tmc-post-main-width, 75% ) !important;
	}

	main .tmc-post-layout > .tmc-post-layout__aside {
		flex-basis: var( --tmc-post-aside-width, 25% ) !important;
	}
}

/* Imported content can be wider than the reading column.

   The posts came from Squarespace carrying figures with an inline width -
   style="width: 2500px" on this one. The constrained layout caps those at the
   820px content size, which was fine when the post WAS 820px wide; now the
   column is 767px and a capped-at-820 figure hung 53px into the rail. Anything
   that can carry its own width is held to the column instead. */
main .tmc-post-layout__main .wp-block-post-content > *,
main .tmc-post-layout__main figure,
main .tmc-post-layout__main img,
main .tmc-post-layout__main iframe,
main .tmc-post-layout__main table {
	max-width: 100% !important;
}

main .tmc-post-layout__main figure {
	width: auto !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

main .tmc-post-layout__main img {
	height: auto;
}

/* The rail is a quieter voice than the post. */
.tmc-post-layout__aside {
	font-size: 0.95em;
}

@media ( min-width: 782px ) {
	.tmc-post-layout__aside {
		border-left: 1px solid var( --wp--preset--color--rule, rgba( 0, 0, 0, 0.12 ) );
		padding-left: var( --tmc-post-aside-gap, 2rem );
	}
}

/* Columns stack below 782px on their own. All the rail needs there is air
   above it and a rule to separate it from the end of the post. */
@media ( max-width: 781px ) {
	.tmc-post-layout__aside {
		margin-top: var( --tmc-mobile-aside-gap, 2.5rem );
		padding-top: var( --tmc-mobile-aside-gap, 2.5rem );
		border-top: 1px solid var( --wp--preset--color--rule, rgba( 0, 0, 0, 0.12 ) );
	}
}

@media ( max-width: 781px ) {
	:root {
		--tmc-benefits-columns: 1;
	}
}


/* ---------------------------------------------------------------------------
   Mobile homepage

   Measured at 375px before changing anything:
     header logo      126x126
     footer logo      120x120, left aligned
     post titles      22px  (larger than the hero h1 at 20.6px)
     slide title      22px, content sitting at the TOP of the image
     category row     left aligned, search 277px
     three columns    93px each - the block has "stack on mobile" turned off

   Every size is a variable, so each can be tuned from Additional CSS without
   another theme update. The breakpoint is 781px, WordPress's own.
   --------------------------------------------------------------------------- */
@media ( max-width: 781px ) {

	/* 1. site logo */
	header .custom-logo,
	header .wp-block-site-logo img {
		width: var( --tmc-mobile-logo, 80px ) !important;
		height: auto !important;
	}

	/* 2. headings - post titles were bigger than the page heading.
	      !important is needed: heading sizes come from a clamp() applied by a
	      class (theme.json fluid typography), which beats a plain element
	      selector. */
	main h1,
	main h1.wp-block-heading,
	main .wp-block-post-title,
	.wp-block-post-title,
	/* The store banner is a <section> beside <main>, not inside it, so
	   every rule scoped to main missed it and its h1 stayed at 31px. */
	.wp-site-blocks > section h1,
	.wp-site-blocks > section h1.wp-block-heading {
		font-size: var( --tmc-mobile-h1, 1.35rem ) !important;
		line-height: 1.25 !important;
	}

	/* The homepage h1 is a long banner line that needed to come down; every
	   other h1 is a page title and must stay larger than the h2 beneath it.
	   One value for both left h1s smaller than their own subtitles. */
	.home main h1,
	.home main h1.wp-block-heading {
		font-size: var( --tmc-mobile-home-h1, 1.05rem ) !important;
	}

	main h2,
	main h2.wp-block-heading,
	.wp-site-blocks > section h2,
	.wp-site-blocks > section h2.wp-block-heading {
		font-size: var( --tmc-mobile-h2, 1.125rem ) !important;
		line-height: 1.3;
	}

	/* h3 and h4 were missed first time round - the "Sharpen your craft"
	   section heading is an h3 and stayed at 20px while everything around it
	   dropped to 18. */
	main h3,
	main h3.wp-block-heading,
	main h4,
	main h4.wp-block-heading,
	.wp-site-blocks > section h3,
	.wp-site-blocks > section h4 {
		font-size: var( --tmc-mobile-h3, 1.05rem ) !important;
		line-height: 1.3 !important;
	}

	/* 2b. The store.

	   Measured at 375px before changing anything:
	     banner section  64px side padding (every other page uses 12)
	     banner h1       31.1px  (other pages 21.6)
	     archive columns 24px side padding
	     product titles  21.6px - they carry .wp-block-post-title, which the
	                     h1 rule above catches even though they are h2
	     buttons         12.8px text in 14.4/28.8 padding, 67px tall

	   The 64px comes from an inline style on the section
	   (--wp--preset--spacing--70), so !important is required to reach it. */
	.wp-site-blocks > section {
		padding-left: var( --tmc-mobile-section-pad, 12px ) !important;
		padding-right: var( --tmc-mobile-section-pad, 12px ) !important;
	}

	/* The product grid is alignwide, so it never escapes the global padding
	   the way the alignfull bands on other pages do. */
	.post-type-archive-product main.has-global-padding,
	.tax-product_cat main.has-global-padding {
		padding-left: var( --tmc-mobile-section-pad, 12px ) !important;
		padding-right: var( --tmc-mobile-section-pad, 12px ) !important;
	}

	/* Product titles only. Scoped to the product grid on purpose: the same
	   class is used by the post cards on /behindtheshot and the other
	   archives, and those are already the size they were signed off at. */
	.wp-block-woocommerce-product-collection h2.wp-block-post-title,
	.wc-block-product-template h2.wp-block-post-title,
	.woocommerce ul.products h2.wp-block-post-title {
		font-size: var( --tmc-mobile-product-title, 1rem ) !important;
		line-height: 1.3 !important;
	}

	/* Store buttons, all one size.

	   Measured at 375px inside a 166px card: the labels are different
	   lengths, so the buttons came out 117, 139 and 166 wide, and
	   "Buy on Barnes & Noble" needed 164px of text width against the
	   134px available - it wrapped to two lines and stood 54px tall
	   against everything else at 37px.

	   Every button is now the full width of its card, so the size no
	   longer depends on the label. nowrap keeps them all one line, which
	   is what makes the heights match; the text has to come down to
	   0.6rem for the longest label to fit, and 8px side padding buys
	   back the room that lets it. The ellipsis is a safety net only - no
	   current label reaches it - so a longer one added later shortens
	   rather than breaking the row. */
	.post-type-archive-product .wp-block-button,
	.tax-product_cat .wp-block-button {
		width: 100% !important;
	}

	.post-type-archive-product .wp-block-button__link,
	.post-type-archive-product .wc-block-components-product-button__button,
	.tax-product_cat .wp-block-button__link,
	.tax-product_cat .wc-block-components-product-button__button {
		font-size: var( --tmc-mobile-button-size, 0.6rem ) !important;
		padding: var( --tmc-mobile-button-pad, 10px 8px ) !important;
		width: 100% !important;
		box-sizing: border-box !important;
		white-space: nowrap !important;
		text-align: center !important;
		justify-content: center !important;
		overflow: hidden !important;
		text-overflow: ellipsis !important;
	}

	/* 2c. Headings inside the grey bands were hanging off both edges.

	   They carry .alignfull, and WordPress gives an alignfull block
	   margin-left/right of -24px so it can break out of the root padding
	   and span the page. Inside a band that is already alignfull and
	   padded to 12px, that pulls the text 12px past the screen on each
	   side - measured at 399px wide in a 375px band, sitting at -12 and
	   387, which is also what gave the homepage horizontal overflow.

	   Zeroing the margins hands the text back to the band's own padding.
	   The extra variable is there if the grey bands ever want more inset
	   than the rest of the page; it adds to the 12px rather than
	   replacing it. */
	main .wp-block-group.alignfull > .alignfull,
	main .wp-block-group.alignfull > .wp-block-heading.alignfull {
		margin-left: 0 !important;
		margin-right: 0 !important;
		max-width: 100% !important;
		padding-left: var( --tmc-mobile-band-text-pad, 0px ) !important;
		padding-right: var( --tmc-mobile-band-text-pad, 0px ) !important;
	}

	/* 3. slideshow: smaller type, and content pushed to the bottom of the
	      image rather than sitting at the top of it */
	.tmc-slide__content {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		/* The original 52px bottom padding held the text up off the floor of the
		   slide. 18px sat it too low - the "Read More" line then overlapped the
		   slide-count bars, which are positioned at bottom:20px. 34px clears them
		   by 11px while keeping the text well below where it started. */
		padding-bottom: var( --tmc-mobile-slide-pad, 34px ) !important;
	}

	.tmc-slide__title {
		font-size: var( --tmc-mobile-slide-title, 1.125rem ) !important;
		line-height: 1.25;
	}

	.tmc-slide__excerpt {
		font-size: var( --tmc-mobile-slide-text, 0.85rem ) !important;
	}

	.tmc-slide__more {
		font-size: var( --tmc-mobile-slide-more, 0.8rem ) !important;
	}

	/* 3b. no gap between the slideshow and the band beneath it. The gap was
	       that band's own top padding, not a margin between blocks - the band
	       starts exactly at the slideshow's bottom edge. Targeted as the
	       slideshow's next sibling so no other band is affected. */
	/* Symmetric padding, so the heading sits centred in the grey band rather
	   than pinned to its top edge. The band still begins exactly at the
	   slideshow's bottom, so there is no gap between the two blocks - the
	   padding is inside the grey, not above it. */
	.home .tmc-slideshow + .wp-block-group {
		padding-top: var( --tmc-mobile-band-pad, 12px ) !important;
		padding-bottom: var( --tmc-mobile-band-pad, 12px ) !important;
	}

	/* 4. the three-column section. The block carries
	      is-not-stacked-on-mobile, so WordPress deliberately keeps it in a row;
	      this overrides that on the front page only, leaving the setting alone
	      everywhere else. */
	.home .wp-block-columns.is-not-stacked-on-mobile {
		flex-wrap: wrap !important;
	}

	.home .wp-block-columns.is-not-stacked-on-mobile > .wp-block-column {
		flex-basis: 100% !important;
		flex-grow: 1;
	}

	/* 5. blog categories and the search field, centred */
	.home .wp-block-group.is-content-justification-space-between {
		justify-content: center;
		text-align: center;
	}

	.home .wp-block-group.is-content-justification-space-between > * {
		justify-content: center;
	}

	.home .wp-block-search {
		margin-left: auto;
		margin-right: auto;
	}

	/* 6. footer logo, smaller and centred */
	footer .wp-block-site-logo {
		text-align: center;
	}

	footer .custom-logo,
	footer .wp-block-site-logo img {
		width: var( --tmc-mobile-footer-logo, 80px ) !important;
		height: auto !important;
		margin-left: auto;
		margin-right: auto;
	}
}


/* ---------------------------------------------------------------------------
   Mobile navigation

   Measured before changing anything: the hamburger sat left of centre, and the
   open overlay showed 19 items - every submenu flattened open - with no
   submenu arrows and items scattered between left:-87 and left:291.

   Collapsed it is 8 items, all the same width, with an arrow on the four
   parents. mobile-nav.js makes those parents tappable to expand, which is
   necessary because they all have href="#" and so cannot be navigated to.
   --------------------------------------------------------------------------- */
@media ( max-width: 781px ) {

	/* 1. hamburger last in the header row, so it sits at the right */
	header .wp-block-navigation {
		order: 9;
	}

	/* 2 + 4. one column, centred, uniform width */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		align-items: center !important;
		justify-content: flex-start !important;
		width: 100%;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item,
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		width: 100%;
		justify-content: center;
		text-align: center;
	}

	/* 3. submenus collapsed until their parent is tapped. The submenu container
	      is normally an absolutely positioned dropdown; in the overlay it has to
	      become an ordinary block or its items land outside the viewport. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
		display: none !important;
		position: static !important;
		width: 100% !important;
		min-width: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		border: 0 !important;
		padding: 0 !important;
		opacity: 1 !important;
		visibility: visible !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .has-child.tmc-open > .wp-block-navigation__submenu-container {
		display: flex !important;
		flex-direction: column;
		align-items: center;
	}

	/* the arrow that says "there is more under here" - WordPress hides it in
	   the overlay, which is why the submenus looked like flat siblings */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-icon {
		display: inline-flex !important;
		visibility: visible !important;
		opacity: 1 !important;
		margin-left: 0.4em;
		transition: transform 150ms ease;
	}

	.wp-block-navigation__responsive-container.is-menu-open .has-child.tmc-open .wp-block-navigation__submenu-icon {
		transform: rotate( 180deg );
	}

	/* 5. bigger menu type */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		font-size: var( --tmc-mobile-menu-size, 1.25rem ) !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
		font-size: var( --tmc-mobile-submenu-size, 1rem ) !important;
	}

	/* 6. the arrow beside the label, not under it.

	      WordPress gives each list item flex-direction:column in the overlay,
	      which is why the submenu button dropped to its own line however wide
	      the item was. Forcing row puts them together; the submenu below still
	      takes a full-width line of its own via flex-basis. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child > .wp-block-navigation-item__content {
		width: auto !important;
		flex: 0 0 auto !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-icon {
		position: static !important;
		width: auto !important;
		height: auto !important;
		flex: 0 0 auto !important;
		margin: 0 0 0 0.35em !important;
		padding: 0 !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item.has-child > .wp-block-navigation__submenu-container {
		flex-basis: 100% !important;
		width: 100% !important;
	}

	/* 7. the icon cluster: 24px gaps used the full width, leaving the social
	      icons flush against the logo. Tightening them moves the cluster right,
	      away from the logo and up against the account and cart icons. */
	header .wp-block-group.is-nowrap {
		gap: var( --tmc-mobile-icon-gap, 12px ) !important;
	}

	/* 8. use the full width.

	      The header row carries is-content-justification-space-between but
	      computed to "center" on mobile, so the logo sat 40px in and the
	      hamburger stopped 40px short. Forcing space-between pushes them to the
	      edges; reducing the header's own padding from 24px reclaims the rest. */
	header.wp-block-group {
		padding-left: var( --tmc-mobile-header-pad, 16px ) !important;
		padding-right: var( --tmc-mobile-header-pad, 16px ) !important;
	}

	header .wp-block-group.is-content-justification-space-between {
		justify-content: space-between !important;
	}

	/* 9. the overlay menu, wider and taller. Its container had 24px side
	      padding, holding items to 327px of a 375px screen. */
	.wp-block-navigation__responsive-container.is-menu-open {
		padding-left: var( --tmc-mobile-overlay-pad, 12px ) !important;
		padding-right: var( --tmc-mobile-overlay-pad, 12px ) !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		padding-top: var( --tmc-mobile-menu-row-pad, 0.45rem ) !important;
		padding-bottom: var( --tmc-mobile-menu-row-pad, 0.45rem ) !important;
	}

	/* 10. centre the menu vertically. The menu sat at the top with ~440px of
	       empty space below it. Centring has to happen on the container, not the
	       inner wrapper - the wrapper is only as tall as its contents. */
	.wp-block-navigation__responsive-container.is-menu-open {
		align-items: center !important;
		justify-content: center !important;
	}

	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding-top: 0 !important;
		align-items: center !important;
		width: 100%;
	}

	/* Centring the container moves the close button with it, so pin it back to
	   the top right. left:auto and margin:0 matter - without them it inherits
	   the centred layout and lands in the middle of the screen. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-close {
		position: absolute !important;
		top: var( --tmc-mobile-close-top, 16px ) !important;
		right: var( --tmc-mobile-close-right, 16px ) !important;
		left: auto !important;
		margin: 0 !important;
		z-index: 5;
	}
}


/* ---------------------------------------------------------------------------
   Section pages on mobile

   /behindtheshot, /photostories, /photographerspotlight, /learningtosee,
   /learn and /thecollectiveeye were built with a 21:9 slideshow and 64px
   section padding. Measured at 375px that is a 161px-tall slide and 247px of
   usable width.

   The slide ratio is an inline variable on the block (--tmc-slide-aspect:21/9),
   not something the mobile rules could reach - this overrides it for phones
   only, so the 21:9 crop is kept on desktop where it works.
   --------------------------------------------------------------------------- */
@media ( max-width: 781px ) {

	.tmc-slideshow {
		--tmc-slide-aspect: var( --tmc-mobile-slide-aspect, 16/9 ) !important;
	}

	/* 64px a side on a 375px screen leaves too little for the text. Brought in
	   line with the homepage. */
	main .wp-block-group.alignfull {
		padding-left: var( --tmc-mobile-section-pad, 12px ) !important;
		padding-right: var( --tmc-mobile-section-pad, 12px ) !important;
	}

	/* Grid groups stack on mobile.

	   /cameraguide's three-up camera sections are Group blocks using WordPress
	   grid layout, not Columns - so none of the column-stacking rules reached
	   them, and they held three 82px tracks on a 395px screen. WordPress has no
	   "stack on mobile" option for grid layout, so it has to be done here. */
	main .wp-block-group.is-layout-grid {
		grid-template-columns: var( --tmc-mobile-grid-columns, 1fr ) !important;
	}
}
