/*
Theme Name: BCH Headshots
Theme URI: https://bostoncreativeheadshots.com
Author: Darren Pellegrino
Description: Block theme for bostoncreativeheadshots.com. Headshot photography studio with a blog and password-protected client galleries. Archivo Black and Archivo, self-hosted. Booking and payment happen at Setmore, not here.
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Version: 1.17.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bch-headshots
*/

/* ------------------------------------------------------------------
   Nearly everything lives in theme.json. This file carries only what
   theme.json cannot express.
   ------------------------------------------------------------------ */


/* ==================================================================
   TUNABLE VALUES
   ==================================================================
   Override these from Appearance / Editor / Styles / Additional CSS
   without editing this file:

       :root { --dp-masonry-gap: 8px; }
   ================================================================== */

:root {
/* Gap comes from the Gallery block's own Block spacing control.

   Core writes that value into --wp--style--unstable-gallery-gap. Reading
   it first means the editor governs and the theme value below is only a
   fallback for galleries that have never had it set. An earlier version
   read the theme variable alone, which made the Block spacing control
   do nothing — the same failure this theme is meant to avoid. */

  --dp-masonry-gap: 2px;
  --dp-masonry-row-gap: 1px;
}


/* ==================================================================
/* ==================================================================
   NATIVE GALLERY — GRID STYLE
   ==================================================================
   Core WordPress has no grid gallery layout. This adds one, registered
   as a block style in functions.php so it appears in the Gallery
   block's Styles panel.

   Deliberately CSS Grid rather than column-count. Column-count fills
   downwards — image 2 lands beneath image 1, not beside it — which
   reorders a gallery visually even when the markup order is correct.
   Squarespace fills across the row, and these galleries were built in
   an order that means something, so the grid matches that.

   Nothing here is a design decision the editor could express: the
   number of columns comes from the block's own Columns control, the
   gap from its Block spacing control. Only the fill direction and the
   breakpoint behaviour live here, because no panel exposes either.

   .has-nested-images is required on every selector: core applies its
   own gallery layout through that class, and a rule without it loses
   on specificity. The figure rules repeat core's :not(#individual-image)
   hack for the same reason — WordPress uses it to inject ID-level
   specificity into a class selector, and without matching it, core
   keeps its calculated width and images render about a third size.
   ================================================================== */

.wp-block-gallery.is-style-masonry.has-nested-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--wp--style--unstable-gallery-gap, var(--dp-masonry-gap));
}
@media (min-width: 1000px) { .wp-block-gallery.is-style-masonry.has-nested-images { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .wp-block-gallery.is-style-masonry.has-nested-images { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* The block's own Columns control. Core writes a columns-N class;
   these map it onto the grid so the slider actually does something.
   Applied from 1200px up — narrow screens keep the breakpoints above,
   because six columns on a phone is unreadable. */

@media (min-width: 1200px) {
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .wp-block-gallery.is-style-masonry.has-nested-images.columns-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

.wp-block-gallery.is-style-masonry.has-nested-images figure.wp-block-image:not(#individual-image) {
  width: 100%;
  max-width: 100%;
  flex-basis: auto;
  flex-grow: 0;
  display: block;
  margin: 0;
}

/* ==================================================================
   CONTACT SHEET — the ten-across proof grid for client galleries.

   The Gallery block's Columns slider stops at eight, so ten cannot be
   set from the editor at all; this class carries it instead. Applied by
   the Client gallery pattern, and usable on any gallery by adding
   bch-contact-sheet in Advanced → Additional CSS class(es).

   Every count is a variable, so a gallery that wants eight or twelve
   can be changed from Additional CSS without touching the theme.

   The class is doubled in the selector on purpose. The columns-N rules
   above are four classes deep, and core writes a columns-N class onto
   every gallery whether or not the slider was touched — matching their
   specificity would leave the winner down to source order. Doubling
   makes this rule five and settles it.

   Cropping stays OFF for these: with it off, gallery-masonry.js gives
   each frame a row span and portrait and landscape pack together at
   their own proportions. Turning Crop on would square everything off
   and cut the tops of heads, which is the one thing a headshot proof
   sheet must not do.
   ================================================================== */

.wp-block-gallery.is-style-masonry.has-nested-images.bch-contact-sheet.bch-contact-sheet {
  grid-template-columns: repeat(var(--bch-sheet-columns-phone, 2), minmax(0, 1fr));
}

@media (min-width: 700px) {
  .wp-block-gallery.is-style-masonry.has-nested-images.bch-contact-sheet.bch-contact-sheet {
    grid-template-columns: repeat(var(--bch-sheet-columns-tablet, 4), minmax(0, 1fr));
  }
}

/* Ten from 1000px rather than 1280px. The editor canvas is narrower than
   the front end - sidebar, admin menu and padding come off the window -
   so a 1280px breakpoint meant the contact sheet never reached ten while
   editing, only after publishing. A proof sheet is meant to be dense, so
   ten at 1000px is the intent anyway. */
@media (min-width: 1000px) {
  .wp-block-gallery.is-style-masonry.has-nested-images.bch-contact-sheet.bch-contact-sheet {
    grid-template-columns: repeat(var(--bch-sheet-columns, 10), minmax(0, 1fr));
  }
}

.wp-block-gallery.is-style-masonry.has-nested-images figure.wp-block-image:not(#individual-image) img {
  display: block;
  width: 100%;
  height: auto;
}

/* "Crop images to fit" — the Gallery block's own toggle.

   Core writes an is-cropped class when it is on, and these rules are
   what make it mean something in a grid: the cell stretches to the
   row's height and the photograph covers it. Without them, images keep
   their own proportions and every row is as tall as its tallest
   picture, leaving white gaps beneath the shorter ones.

   An earlier version of this file set align-items:start and
   object-fit:unset, which forced exactly that ragged result and made
   the Crop toggle do nothing. Turn the toggle off and images return to
   their natural shapes; that is the control, not this file. */

.wp-block-gallery.is-style-masonry.has-nested-images.is-cropped
  figure.wp-block-image:not(#individual-image) {
  height: 100%;
}

.wp-block-gallery.is-style-masonry.has-nested-images.is-cropped
  figure.wp-block-image:not(#individual-image) img {
  height: 100%;
  object-fit: cover;
}


/* Masonry packing, once the script has measured the frames.

   Squarespace gives every image the same column width, keeps its own
   height, and packs with no gaps. Reproducing that while still reading
   left-to-right needs the row spans the script writes; these rows are
   the unit it counts in. 4px is small enough that a span lands within
   a rounding error of the real height.

   Scoped to :not(.is-cropped) so the block's "Crop images to fit"
   toggle chooses the layout: off gives masonry with whole photographs,
   on gives the uniform grid above. Neither is decided here. */

.wp-block-gallery.is-style-masonry.has-nested-images.dp-masonry-ready:not(.is-cropped) {
  grid-auto-rows: 4px;
}

.wp-block-gallery.is-style-masonry.has-nested-images.dp-masonry-ready:not(.is-cropped)
  figure.wp-block-image:not(#individual-image) {
  height: auto;
  align-self: start;
}

/* Gallery captions: undo core's overlay treatment, and nothing else.

   Core styles gallery captions as white text floated over the image on
   its own GPU layer. On a white page that is invisible writing in a
   frame that never grows to fit it, so the overlay has to be undone.

   What is NOT set here: font-family, font-size, line-height,
   letter-spacing or weight. An earlier version pinned all of those to
   `inherit`, which reads as harmless but is not — this selector carries
   ID-level specificity, so it outranked anything the Captions control
   in Styles wrote, and that panel would have looked functional while
   doing nothing. Caption typography belongs in theme.json's caption
   element, where the editor can change it.

   Colour is the one typographic property stated, because core forces
   white and no editor control can override a rule this specific.
   Changing caption colour in Styles will not take; that is the single
   cost of this block. */

.wp-block-gallery.is-style-masonry.has-nested-images
  figure.wp-block-image:not(#individual-image) figcaption {
  color: inherit;
  /* Releasing the compositing layer. macOS renders layer text with
     grayscale rather than subpixel antialiasing, which looks heavier
     and softer than identical text beside it. */
  will-change: auto;
  transform: none;
  backface-visibility: visible;
  background: none;
  position: static;
}

   IMPORTED SQUARESPACE GALLERIES
   ==================================================================
   Pages not yet converted to native Gallery blocks still carry
   Squarespace's markup and class names but none of its CSS. These
   rules lay those out until conversion, and can be deleted once every
   gallery page has been converted.
   ================================================================== */

.entry-content .gallery-masonry,
.entry-content .gallery-reel {
  position: relative;
  width: 100vw;
  max-width: none;
  left: 50%;
  right: auto;
  margin-left: -50vw;
  margin-right: 0;
  transform: none;
  padding: 0;
}

.gallery-masonry-wrapper {
  column-count: 2;
  column-gap: var(--wp--style--unstable-gallery-gap, var(--dp-masonry-gap));
  width: 100%;
  margin: 0;
  padding: 0;
}

@media (min-width: 1000px) { .gallery-masonry-wrapper { column-count: 3; } }
@media (min-width: 1200px) { .gallery-masonry-wrapper { column-count: 4; } }

.gallery-masonry-item {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: block;
  width: 100%;
  margin: 0 0 var(--wp--style--unstable-gallery-gap, var(--dp-masonry-row-gap));
  padding: 0;
}

/* Squarespace wrapped each image in a paragraph tag; strip its spacing. */
.gallery-masonry-item-wrapper,
.gallery-masonry-item-wrapper p,
.gallery-reel-item-wrapper,
.gallery-reel-item-wrapper p {
  margin: 0;
  padding: 0;
  line-height: 0;
}

.gallery-masonry-item img {
  display: block;
  width: 100%;
  height: auto;
}

/* Reel: horizontal filmstrip at uniform height, as the photo stories
   had on Squarespace. */

.gallery-reel-wrapper,
.gallery-reel-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.gallery-reel-item {
  flex: 0 0 auto;
  height: clamp(280px, 52vh, 520px);
  margin: 0;
  padding: 0;
  position: static;
  scroll-snap-align: center;
}

.gallery-reel-item img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: cover;
}

/* TEMPORARY. These are Squarespace's own caption elements on the story
   pages not yet converted to native Gallery blocks. The editor cannot
   reach them — they are not WordPress captions — so the typography is
   stated here to stop them defaulting to something unrelated.

   Delete this whole IMPORTED SQUARESPACE GALLERIES section once every
   story page has been converted. */

.gallery-caption,
.gallery-caption-content {
  font: inherit;
  color: inherit;
  padding-top: 0.6rem;
}

/* Squarespace controls that no longer function. */

.gallery-lightbox,
.gallery-reel-control,
.gallery-reel-control-btn,
.gallery-masonry-control-btn,
.sqs-video-icon {
  display: none !important;
}

/* Squarespace's carousel script parked frames at -9999px; without the
   script they must be restored or the reel renders empty. Scoped to
   reels only — an earlier version targeted every fe-block on the page
   and flattened the grid on About, Books and Contact. */

.gallery-reel [class*="fe-block"],
.gallery-reel [class*="sqs-block"] {
  position: static !important;
  transform: none !important;
}


/* ==================================================================
   FOOTER
   ==================================================================
   Holds the bottom of the viewport on short pages. The margin-top:auto
   only takes effect when content is shorter than the viewport; on long
   gallery pages it resolves to 0 and nothing moves.

   No alignment default here on purpose — centre individual blocks from
   the editor toolbar where you want it.
   ================================================================== */

.wp-site-blocks {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wp-site-blocks > footer {
  margin-top: auto;
}


/* ==================================================================
   NAVIGATION SUBMENUS
   ==================================================================
   WordPress gives dropdown panels a narrow default width, so long
   labels wrap. "Where The Dunes Meet The Sea" was breaking onto four
   lines. Sizing the panel to its content keeps every item on one row.
   ================================================================== */

.wp-block-navigation__submenu-container {
  width: auto;
  min-width: max-content;
}

.wp-block-navigation__submenu-container .wp-block-navigation-item__content {
  white-space: nowrap;
}

/* On mobile the menu is a full-screen overlay where wrapping is
   correct — a narrow screen cannot fit a 440px row. */

@media (max-width: 600px) {
  .wp-block-navigation__submenu-container {
    min-width: 0;
  }
  .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    white-space: normal;
  }
}


/* ==================================================================
   ODDS AND ENDS
   ================================================================== */

/* Centre the mobile menu, the way Squarespace did.

   Core stacks the overlay items hard left. The alignment does not come
   from a plain align-items declaration - it is driven by a custom
   property core sets from the block's justification, which is why
   overriding align-items directly does nothing. Setting the property
   is what actually moves them.

   Scoped to .is-menu-open, which only exists while the overlay is
   showing. The navigation is set to overlay on mobile only, so the
   desktop bar is untouched.

   This does not disable anything: the block's justification control
   still governs the desktop bar, which is the only place it was ever
   visible. */

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__submenu-container {
  --navigation-layout-justification-setting: center;
  --navigation-layout-align: center;
  text-align: center;
}


/* Centre the overlay on the screen, not just the text.

   The earlier rule centred each item inside the menu's own box, but
   that box sat top-left and shrank to fit its content — so with the
   submenus collapsed the whole menu drifted left. Centring the
   container and giving the list its full width puts the menu in the
   middle of the screen both ways. */

@media (max-width: 600px) {
  .wp-block-navigation__responsive-container.is-menu-open {
    align-items: center;
    justify-content: center;
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__responsive-container-content {
    width: 100%;
    align-items: center;
    justify-content: center;
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__container {
    width: 100%;
  }

  /* A chevron beside the items that open.

     Core ships this icon and then hides it: with open-on-click it
     renders the arrow as a sibling of the toggle button rather than
     inside it, and its own stylesheet suppresses the stray. Nothing
     then tells anyone that Work and Stories expand. Showing it costs
     no markup — the SVG is already in the page.

     Rotated a quarter turn so it points right while closed, and back
     to its own orientation when open, which reads as the menu
     unfolding. The rotation follows aria-expanded, so core's button
     still drives it.

     The list item is a column by default, which dropped the arrow
     onto its own line under the label. Row plus wrap keeps label and
     arrow together while the submenu still takes a full-width line of
     its own beneath them. */

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-item.has-child {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
  }

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

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-item.has-child
    > .wp-block-navigation__submenu-icon {
    display: inline-flex;
    transform: rotate(-90deg);
    transition: transform 0.2s ease;
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-item.has-child:has(> button[aria-expanded="true"])
    > .wp-block-navigation__submenu-icon {
    transform: rotate(0deg);
  }

  /* Menu-sized type in the overlay.

     The Navigation block carries one font size and it has to suit the
     desktop bar, where 15px is right. Fifteen pixels on a full-screen
     phone menu is not - Squarespace ran its mobile menu two to three
     times the size of its nav bar.

     Set on the link and button elements rather than the list items:
     the list item is only a box, and core sizes the text on the
     element inside it.

     What this costs: the Navigation block's font size no longer shows
     in the overlay - change it and the desktop bar moves while the
     menu stays 25px. Everything else on the block still applies, the
     typeface and colour included. Change these two numbers to resize
     the menu. */

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__container > li > .wp-block-navigation-item__content {
    font-size: 25px;
  }

  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
    font-size: 16px;
  }
}


/* Mobile header: logo and hamburger on one line, icons and the
   button centred underneath.

   Everything here is a phone-width rearrangement, and the editor has
   no breakpoint controls - a block is laid out one way at every size.
   So this is CSS by necessity, not by preference. It changes nothing
   above 600px: the desktop bar is still governed entirely by the
   header's own layout, justification and spacing controls, and the
   logo size, icon size and button styling stay editor settings at
   every width.

   The header nests the navigation, the social icons and the button
   inside one right-justified group. display:contents dissolves that
   group at phone width so all four land in the outer flex row, which
   is already set to space-between - logo left, hamburger right. The
   icons and the button then each claim a full row and centre
   themselves.

   The logo is capped rather than left at its own width. At 375px it
   fills the line on its own and pushes the hamburger onto a second
   row; the cap leaves exactly enough for it. Squarespace does the
   same thing - its mobile logo runs about 220px against 300 on the
   desktop.

   Selectors match on what a group contains rather than on its
   justification classes, so changing the header's alignment in the
   editor cannot detach these rules.

   Note the header itself is customised in the Site Editor, so it is
   reachable from CSS only - editing parts/header.html would have no
   effect on the live site. */

@media (max-width: 600px) {
  header .wp-block-group:has(> .wp-block-site-logo) {
    align-items: center;
  }

  header .wp-block-group:has(> .wp-block-social-links) {
    display: contents;
  }

  /* Buy the logo back its width.

     Three things were eating it on a 390px screen: 24px of header
     padding each side, a 24px gap before the hamburger, and 16px of
     padding each side on the logo block itself. That is 104px spent
     before the artwork gets any.

     The header's padding and the logo's padding are both set inline
     by their blocks, so a stylesheet rule loses to them. A negative
     margin on the row reaches the first; the second needs
     !important, which is why it is here. Both are phone-width only -
     the desktop padding Darren set still governs above 600px, which
     is what it was added for.

     The logo box must also be allowed to grow. Left at flex 0 the box
     shrinks to the artwork's intrinsic width and stops, which is what
     held it at 305px with room to spare beside it.

     Sizing is then a judgement between two measured ends: 294px read
     as too small, 342px - the ceiling while the logo and hamburger
     share a row - as too big. This sits at the midpoint, 318px, and
     spends the difference on the gap: 32px between the artwork and
     the button, against 8px at the ceiling.

     The hamburger is then held 16px off the screen edge rather than
     the 8px the row's negative margin would give it.

     Three numbers below, and they all trade against each other,
     because the row is a fixed 374px on a 390px screen. column-gap is
     the space beside the button. The nav's margin-right is how far
     the button sits off the edge. The reserve is the sum of those two
     plus the 24px button, and the logo takes what is left - so widen
     either space and the reserve must grow to match, at the logo's
     expense. */

  header .wp-block-group:has(> .wp-block-site-logo) {
    margin-left: -1rem;
    margin-right: -1rem;
    column-gap: 1.5rem;
  }

  header .wp-block-site-logo {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: calc(100% - 4rem);   /* button + its gap + its inset */
  }

  header .wp-block-site-logo a,
  header .wp-block-site-logo img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }

  header .wp-block-navigation {
    flex: 0 0 auto;
    margin-right: 0.5rem;   /* holds the button off the screen edge */
  }

  header .wp-block-social-links,
  header .wp-block-buttons {
    flex-basis: 100%;
    justify-content: center;
  }
}


/* Home page on a phone: centre everything.

   Squarespace alternates - Experience and Trusted By centred, About,
   Rates and Contact ranged left - and the rebuild matches it at every
   width. On a phone Darren wants the lot centred, which is a
   deliberate departure from the desktop, not a correction to it.

   Text alignment is a block control, but it is one value per block,
   not one per breakpoint, so a phone-only override cannot be
   expressed in the editor. Above 600px every alignment control still
   governs, and turning this off is deleting one rule.

   Scoped to body.home. Centred body copy is harder to read in long
   runs, and the blog posts are long runs, so this does not reach
   them.

   The two rules under the first are consequences of centring rather
   than choices. A bulleted list centres its text but keeps its bullet
   gutter, so the lines sit off to the right of true centre - moving
   the marker inside and dropping the indent fixes that. And the About
   portrait is set to align right, which floats it off centre; on one
   column there is nothing to flow beside it anyway. */

@media (max-width: 600px) {
  body.home .wp-block-post-content {
    text-align: center;
  }

  body.home .wp-block-post-content :is( ul, ol ).wp-block-list {
    list-style-position: inside;
    padding-left: 0;
  }

  body.home .wp-block-post-content .wp-block-image.alignleft,
  body.home .wp-block-post-content .wp-block-image.alignright {
    float: none;
    margin-left: auto;
    margin-right: auto;
  }
}


/* Keep submenus shut in the overlay until they are tapped.

   The block is set to open submenus on click, and core honours that:
   the toggle button is there and reports aria-expanded="false". Its
   overlay stylesheet then displays the submenu anyway, so Work and
   Stories arrived pre-opened and the menu ran nine hundred pixels
   tall.

   Keying off aria-expanded rather than a class means core's own
   button still drives it — flip the attribute and the submenu
   reappears, which is exactly what the toggle does. Nothing here
   fights the block's setting; turn "open submenus on click" back off
   and this rule stops matching, because the button disappears with
   it. */

@media (max-width: 600px) {
  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-item.has-child:has(> button[aria-expanded="false"])
    > .wp-block-navigation__submenu-container {
    display: none;
  }
}


/* Justified galleries — the second gallery shape.

   Every image in a row shares a height; the widths follow each
   photograph's own proportions and the row fills the container. That is
   what Squarespace uses on the backgrounds page, where a portrait is
   237px wide and a landscape 533px, both 355px tall.

   The heights and widths are written by the script, because no CSS can
   work out how many images fit a row at a common height. This file only
   sets the flow: a wrapping flex row, images filling whatever box the
   script gives them.

   There is deliberately no Columns control here. A justified layout has
   no column count - one row takes five images and the next takes six,
   depending which orientations land where. The block's Columns slider
   has no effect on this style, which is why the masonry style still
   exists for galleries where you do want to choose.

   Without JavaScript this stays a plain wrapped flex row: uneven, but
   every photograph visible and in order. */

.wp-block-gallery.is-style-justified.has-nested-images {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wp--style--unstable-gallery-gap, var(--dp-masonry-gap));
  align-items: flex-start;
}

.wp-block-gallery.is-style-justified.has-nested-images
  figure.wp-block-image:not(#individual-image) {
  margin: 0;
  max-width: none;
  flex: 1 1 auto;
  overflow: hidden;
}

.wp-block-gallery.is-style-justified.has-nested-images
  figure.wp-block-image:not(#individual-image) img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* "Read More" on excerpt cards.

   Bolded here because the Post Excerpt block's typography controls
   apply to the whole excerpt, and nothing in the editor targets the
   more-link on its own. The link text itself is a block attribute you
   can change - this only sets its weight.

   The chevrons are part of the text, not added by CSS, so they survive
   translation and copy-paste and are read aloud correctly. */

.wp-block-post-excerpt__more-link {
  font-weight: 700;
}


/* Keep focus visible — the theme removes underlines from links. */

a:focus-visible,
button:focus-visible,
.wp-block-button__link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ==================================================================
   CONTACT FORM
   ==================================================================
   Fluent Forms ships its own look: rounded corners, grey borders,
   system fonts and a blue submit button. None of that belongs on a
   two-colour site, so the form is restyled to match everything else —
   square corners, the site's typeface, a black button.

   Selectors are scoped to .fluentform so nothing here touches the
   WooCommerce checkout or comment forms.
   ================================================================== */

.fluentform .ff-el-form-control {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: var(--wp--preset--color--contrast);
  background-color: var(--wp--preset--color--base) !important;
  border: 1px solid var(--wp--preset--color--contrast) !important;
  border-radius: 0;
  padding: 0.7rem 0.9rem;
  box-shadow: none;
}

/* iOS zooms the whole page in when you tap a field whose text is
   under 16px, and never zooms back out — the visitor is left dragging
   a magnified page around to reach the send button. The body size is
   15px, which the fields inherit, so this lifts them the one pixel
   that stops it. Phone widths only; nothing changes on a desktop.

   This is a browser workaround, not a design choice: it overrides the
   inherited body size on these fields below 600px. Changing body type
   in Global Styles still governs everywhere else, and every other
   control on the form is untouched. */

@media (max-width: 600px) {
  .fluentform .ff-el-form-control {
    font-size: 16px;
  }
}

.fluentform .ff-el-form-control:focus {
  border-color: var(--wp--preset--color--contrast);
  outline: 2px solid var(--wp--preset--color--contrast);
  outline-offset: 1px;
  box-shadow: none;
}

.fluentform textarea.ff-el-form-control {
  min-height: 100px;   /* Squarespace ran the message box at 100px */
  resize: vertical;
}

/* Labels: the site's own small-caps treatment rather than Fluent's. */

.fluentform .ff-el-input--label label {
  font-family: inherit;
  font-size: var(--wp--preset--font-size--small);
  font-weight: 500;
  color: var(--wp--preset--color--contrast);
  margin-bottom: 0.35rem;
}

.fluentform .ff-el-is-required.asterisk-right label:after {
  color: var(--wp--preset--color--contrast);
}

/* Submit: the theme's button, not Fluent's blue. */

.fluentform .ff-btn-submit,
.fluentform button[type="submit"] {
  background-color: var(--wp--preset--color--contrast) !important;
  background-image: none !important;
  color: var(--wp--preset--color--base) !important;
  font-family: var(--wp--preset--font-family--display, 'Archivo Black', 'Arial Black', sans-serif);
  font-size: var(--wp--preset--font-size--small);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid var(--wp--preset--color--contrast);
  border-radius: 0;
  padding: 0.9rem 1.6rem;
  box-shadow: none;
  transition: background 160ms ease, color 160ms ease;
}

.fluentform .ff-btn-submit:hover,
.fluentform button[type="submit"]:hover {
  background-color: var(--wp--preset--color--base) !important;
  color: var(--wp--preset--color--contrast) !important;
}

.fluentform .ff-btn-submit:focus-visible,
.fluentform button[type="submit"]:focus-visible {
  outline: 2px solid var(--wp--preset--color--contrast);
  outline-offset: 3px;
}

/* Validation messages in the site's own red-free palette. */

.fluentform .error.text-danger,
.fluentform .ff-el-is-error .text-danger {
  font-family: inherit;
  font-size: var(--wp--preset--font-size--fine);
}


/* ==================================================================

/* Turn the arrow to match the submenu it controls.

   The state lives on the toggle's aria-expanded, so the arrow is read
   off the same attribute that hides the submenu - one source of truth,
   and it cannot drift out of step with what is on screen.

   Overlay only. The desktop bar's arrow is a static indicator that a
   submenu exists and should not spin. */

.wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation-submenu__toggle svg {
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-navigation__responsive-container.is-menu-open
    .wp-block-navigation-submenu__toggle svg {
    transition: none;
  }
}

.wp-block-navigation__responsive-container.is-menu-open
  .wp-block-navigation-submenu__toggle[aria-expanded="true"] svg {
  transform: rotate( 180deg );
}

/* Mobile footer: range everything left.

   The footer is three columns on a desktop, and its blocks are aligned
   to suit that - Contact left, Follow centred, Hours right, the two
   closing lines centred across the full width. Stacked into one column
   on a phone those alignments have nothing left to line up with and
   just look scattered, so they all range left.

   :root prefixes the alignment-class selectors because core ships
   ":root .has-text-align-center", which would otherwise tie this on
   specificity and win on order. The prefix is there to outrank that
   one rule, nothing more.

   Every alignment is still a block control and still governs the
   desktop, which is the only place those three columns exist. */

@media (max-width: 600px) {
  footer {
    text-align: left;
  }

  :root footer .has-text-align-center,
  :root footer .has-text-align-right,
  :root footer .has-text-align-left {
    text-align: left;
  }

  footer .wp-block-social-links,
  footer .wp-block-buttons {
    justify-content: flex-start;
  }
}


/* Form labels stay left while the rest of the home page centres.

   The phone-width rule further up centres everything on the home page,
   and it caught the contact form with it - centred labels sitting over
   full-width fields, which reads as a mistake rather than a choice.
   A label belongs at the left edge of the field it names.

   Only the labels move. The section's heading and its text still
   centre with the rest of the page. */

@media (max-width: 600px) {
  body.home .wp-block-post-content .fluentform {
    text-align: left;
  }

  :root body.home .wp-block-post-content .fluentform .has-text-align-center {
    text-align: left;
  }
}
