/* Foundry Bakehouse — page scaffolding */

.fbh-wrap {
  width: min(100% - (var(--fbh-gutter) * 2), var(--fbh-wrap));
  margin-inline: auto;
}

.fbh-wrap--narrow { width: min(100% - (var(--fbh-gutter) * 2), 52rem); }

/* The header and its utility strip sit on a wider measure than body content:
   a navigation row has more to fit than a paragraph should ever be wide. */
.fbh-wrap--wide { width: min(100% - (var(--fbh-gutter) * 2), 96rem); }

.fbh-section {
  padding-block: var(--fbh-space-3xl);
  background: var(--fbh-ground);
  color: var(--fbh-ink);
}

.fbh-section--flush { padding-block: 0; }

/* The band scale. These are a ladder, not a palette: each rung is at least a
   1.13 contrast ratio from every other, so any two can sit next to each other
   and still read as two sections. Before this they were four near-identical
   creams — tint-2 against warm measured 1.003, which is no edge at all. */
.fbh-section--tint    { background: var(--fbh-ground-2); }     /* soft, lightest tint  */
.fbh-section--tint-2,
.fbh-section--cool    { background: var(--fbh-ground-cool); }  /* teal tint, cool hue  */
.fbh-section--warm    { background: var(--fbh-ground-warm); }  /* sand, deepest tint   */

/* The two deep bands need their own ink. The ordinary hairline disappears into
   the teal one (1.04 against the ground), and on both of them the muted ink and
   the brand drop under 4.5:1 — they were measured against the light grounds.
   Swapping the tokens inside the band fixes every descendant at once, and the
   replacements are the same hues taken darker, so nothing leaves the palette. */
.fbh-section--tint-2,
.fbh-section--cool,
.fbh-section--warm {
  --fbh-line: var(--fbh-line-strong);
  --fbh-ink-2: var(--fbh-deep-ink-2);
  --fbh-ink-3: var(--fbh-deep-ink-2);
  --fbh-brand: var(--fbh-deep-brand);
}
.fbh-section--surface { background: var(--fbh-surface); }
/* Templates mark the page ground explicitly; it was a bare marker class with
   no rule behind it, which is why two of them in a row on /gift-sets/ merged
   into one slab. */
.fbh-section--ground  { background: var(--fbh-ground); }

/* A photographic band.

   The scrim is 0.88 espresso, which is heavier than it looks like it needs to
   be. It is measured, not guessed: the Molder photograph has blown highlights
   in the sky (luminance 1.00 at the brightest pixel), and cream body copy only
   clears 4.5:1 against that once the wash reaches 0.88. Anything lighter puts
   the text under AA wherever it crosses the sky. The consequence is that the
   picture reads as a texture rather than a photograph — the design uses this
   statue as a framed side image on a solid band instead, which is the better
   home for it if the photograph is meant to be seen. */
.fbh-section--photo {
  position: relative;
  background-image: var(--fbh-section-photo);
  background-size: cover;
  /* Anchored to the top, not the centre. These bands are wide and short, so
     cover shows only a horizontal slice of a tall photograph: on the Molder
     statue, centring put the window at 33-67% of the image and cut the head
     off entirely, since it sits at 2-12%. Top keeps the subject's head in
     frame at every width. A section can override it with background_position. */
  background-position: var(--fbh-section-photo-pos, center top);
  color: var(--fbh-on-contrast);
}

/* Deeper than a normal band: the taller the band, the more of the photograph
   the crop can show. Under cover the drawn picture is 100vw/1.752 tall and
   keeps growing with the window, so a padding clamp alone cannot keep up: once
   it hit its 12rem ceiling the band stopped at about 720px while the plate
   went on to 1096px at 1920, and the crop closed over the molder's mouth. It
   looked right at 1440 and wrong on the monitors most people actually use.

   So the height tracks the picture instead. Measured off the plate rather
   than guessed: the molder's face runs from 2% to roughly 78%, and the ink
   of the Foundry roundel reaches 93%. min-height holds the band at 56vw,
   which shows about 98% of 100vw/1.752, clearing the roundel with air under
   it. 46vw was enough for the face alone but stopped at 80.6% from 1920 up
   and cut the bottom off the logo, and 53vw landed exactly on its last row.
   Capped at 100rem so an ultra-wide window does not get an unbounded band.
   Padding sets the air around the copy, min-height guarantees the picture. */
.fbh-section--photo {
  display: grid;
  align-content: center;
}

/* Opt in with background_fill. Everything above is about one picture, the
   Molder plate on the home page, where the band has to be deep enough to
   reveal a particular statue and a particular logo. A photograph used simply
   as the ground behind a hero does not want a 1075px band, so it keeps the
   ordinary section rhythm and only this variant gets the depth. */
.fbh-section--photo-fill {
  padding-block: clamp(9rem, 5.5rem + 11vw, 18rem);
  min-height: min(56vw, 100rem);
}
/* Opt in with background_fit => 'contain'. The band takes the picture's own
   shape, from --fbh-section-photo-ratio, which inc/sections.php reads off the
   file, so the whole picture shows: nothing is cropped and no band is left
   over under it. That is also why the padding goes — the measurements above
   exist to steer a crop, and there is no crop here.

   aspect-ratio sets the height but does not cap it, so where the copy is
   taller than the picture — a phone, mostly — the band grows to hold the copy
   and the picture sits centred in it rather than being cut to fit. */
.fbh-section--photo-contain {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: var(--fbh-section-photo-pos, center);
  aspect-ratio: var(--fbh-section-photo-ratio, 16 / 9);
  min-height: 0;
  padding-block: 0;
}

/* The air around the copy moves onto the wrap. On the section it would be
   added to the picture's height and show as a band of ground below the
   image; on the wrap it only counts once the copy is the taller of the two,
   which is exactly when the copy needs room. */
.fbh-section--photo-contain > * { padding-block: var(--fbh-space-xl); }

.fbh-section--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(49 41 35 / 0.88);
}
.fbh-section--photo > * { position: relative; z-index: 1; }
.fbh-section--photo :is(h1, h2, h3, .fbh-sectionhead__title) { color: var(--fbh-on-contrast); }
.fbh-section--photo .fbh-eyebrow { color: var(--fbh-contrast-muted); }
.fbh-section--photo .fbh-sectionhead__intro,
.fbh-section--photo p { color: var(--fbh-contrast-muted); }

/* The italic half of a heading. On a light ground it is --fbh-ink-2, a quiet
   brown that reads as the second half of the sentence; over the espresso wash
   that same brown all but vanishes — 1.56:1 against the worst pixel the wash
   can produce, with the roman half beside it at 8.02. It takes the muted
   contrast tone instead, the one the eyebrow and the body copy already use
   here, which holds 4.62:1 even where the photograph behind it goes to pure
   white, and keeps the same quieter-than-the-heading relationship. */
.fbh-section--photo :is(h1, h2, h3, .fbh-sectionhead__title, .fbh-hero__title) em {
  color: var(--fbh-contrast-muted);
}

/* The light plate. The molder arrives in two cuts: a dark photograph, which
   wants the espresso wash above, and a pale one, which does not. Measured on
   the light file (mean relative luminance 0.62 against 0.25 for the dark
   one): a cream wash at 0.65 puts solid ink over 4.5:1 on every pixel in the
   image, worst case 5.85, while still leaving the picture visible.

   Everything here is ink rather than the muted browns. The statue's bronze
   stays dark under the wash, and --fbh-ink-2 only reaches 2.56 against it,
   so the muted colours the dark plate uses would fail outright. Raising the
   wash far enough to rescue them would hide the photograph, which is the
   whole point of the light cut.

   Compounded with --photo because components.css loads after this file and
   styles the same button at equal specificity. */
.fbh-section--photo.fbh-section--photo-light { color: var(--fbh-ink); }
.fbh-section--photo.fbh-section--photo-light::before { background: rgb(241 232 221 / 0.65); }
.fbh-section--photo.fbh-section--photo-light :is(h1, h2, h3, .fbh-sectionhead__title) { color: var(--fbh-ink); }
.fbh-section--photo.fbh-section--photo-light .fbh-eyebrow { color: var(--fbh-ink); }
.fbh-section--photo.fbh-section--photo-light .fbh-sectionhead__intro,
.fbh-section--photo.fbh-section--photo-light p { color: var(--fbh-ink); }
.fbh-section--photo.fbh-section--photo-light :is(h1, h2, h3, .fbh-sectionhead__title, .fbh-hero__title) em {
  color: var(--fbh-ink-2);
}
.fbh-section--photo.fbh-section--photo-light .fbh-btn--secondary {
  --btn-fg: var(--fbh-ink);
  --btn-bd: var(--fbh-ink);
}

/* The full teal band. A hue and a weight nothing else on the page has, so it
   breaks a long run of tints outright. One per page — it is a punctuation
   mark, not a tint, and the owner asked for light throughout. */
.fbh-section--band {
  background: var(--fbh-band);
  color: var(--fbh-on-band);
}
.fbh-section--band .fbh-sectionhead__title,
.fbh-section--band h1, .fbh-section--band h2, .fbh-section--band h3 { color: var(--fbh-on-band); }
.fbh-section--band .fbh-eyebrow { color: rgb(241 232 221 / 0.78); }
.fbh-section--band .fbh-sectionhead__intro,
.fbh-section--band p { color: rgb(241 232 221 / 0.86); }

/* Same problem as the photographic band, worse: --fbh-ink-2 on teal measures
   1.09:1, which is no text at all. The band's own body cream at 0.86 reads as
   the quieter half at 4.63:1. */
.fbh-section--band :is(h1, h2, h3, .fbh-sectionhead__title, .fbh-hero__title) em {
  color: rgb(241 232 221 / 0.86);
}
.fbh-section--band a { color: var(--fbh-on-band); }

/* Anything that paints its own light surface inside the band keeps the normal
   ink: without this the inherited white lands on a white card and the text
   disappears. Scoped one level deeper than the rules above so it wins. */
.fbh-section--band :is(.fbh-card, .fbh-form, .fbh-newsletter, .fbh-badge, .fbh-panel, .fbh-tile__body) {
  color: var(--fbh-ink);
}
.fbh-section--band :is(.fbh-card, .fbh-form, .fbh-newsletter, .fbh-badge, .fbh-panel) :is(h1, h2, h3, h4, h5, h6) {
  color: var(--fbh-ink);
}
.fbh-section--band :is(.fbh-card, .fbh-form, .fbh-newsletter, .fbh-badge, .fbh-panel) p {
  color: var(--fbh-ink-2);
}
.fbh-section--band :is(.fbh-card, .fbh-form, .fbh-newsletter, .fbh-badge, .fbh-panel) a {
  color: var(--fbh-brand);
}

/* Belt and braces. The tone a section is given is already stepped a rung when
   it would have repeated the one above it (see fbh_section_atts), so this
   should never fire; it stays as a hairline for any section that sets its
   class directly rather than going through that function. */
.fbh-section--tint + .fbh-section--tint,
.fbh-section--cool + .fbh-section--cool,
.fbh-section--tint-2 + .fbh-section--tint-2,
.fbh-section--warm + .fbh-section--warm,
.fbh-section--ground + .fbh-section--ground,
.fbh-section--surface + .fbh-section--surface { border-top: 1px solid var(--fbh-line); }

/* The design's dark panel. Kept available, but the theme defaults to the warm
   tint above because the bakery is not a moody place. */
.fbh-section--contrast {
  background: var(--fbh-contrast);
  color: var(--fbh-on-contrast);
}
.fbh-section--contrast a:hover { color: var(--fbh-on-contrast); }
.fbh-section--contrast .fbh-eyebrow { color: var(--fbh-contrast-muted); }
.fbh-section--contrast .fbh-sectionhead__intro,
.fbh-section--contrast .fbh-card__body p { color: var(--fbh-contrast-muted); }

/* And again on the dark panel, where --fbh-ink-2 reaches 2.29:1. The muted
   contrast tone takes it to 6.79. */
.fbh-section--contrast :is(h1, h2, h3, .fbh-sectionhead__title, .fbh-hero__title) em {
  color: var(--fbh-contrast-muted);
}

/* Two consecutive sections with the same ground read as one; tighten them. */
.fbh-section + .fbh-section:not([class*="--"]) { padding-block-start: 0; }

.fbh-sectionhead { max-width: var(--fbh-measure); margin-bottom: var(--fbh-space-xl); }
.fbh-sectionhead--wide { max-width: 46rem; }

.fbh-sectionhead__title { margin-bottom: var(--fbh-space-s); }
.fbh-sectionhead__title em { font-style: italic; font-weight: 400; color: var(--fbh-ink-2); }
.fbh-sectionhead__intro { color: var(--fbh-ink-2); font-size: var(--fbh-step-1); }

.fbh-eyebrow {
  margin: 0 0 var(--fbh-space-xs);
  font-family: var(--fbh-font-text);
  font-size: var(--fbh-step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fbh-brand);
}

/* Grids ------------------------------------------------------------------ */

.fbh-grid { display: grid; gap: var(--fbh-space-m); }
.fbh-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.fbh-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.fbh-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14.5rem), 1fr)); }

/* Rows of ruled items — steps, stats, the link row ------------------------
   These all draw a rule above each item, so a half-empty final row reads as a
   mistake rather than as wrapping. The count comes from the template (see
   fbh_row_class), which lets the breakpoints avoid an orphan: four items go
   1 -> 2 -> 4 and never 3 + 1. auto-fit could not do this, because it never
   knows how many items it is placing. */

.fbh-rowgrid { display: grid; grid-template-columns: 1fr; }

/* One row on desktop, stacked everywhere below it. 64rem rather than 48rem:
   at 768px a tablet was still being given three columns, which left the copy
   in ~200px ribbons. Every item is minmax(0, 1fr), so the columns — and the
   rules above them — are always exactly equal. */
@media (min-width: 64rem) {
  .fbh-rowgrid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fbh-rowgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fbh-rowgrid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* Nothing ships five or six yet; three keeps the rows balanced if it does. */
  .fbh-rowgrid--5,
  .fbh-rowgrid--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.fbh-split {
  display: grid;
  gap: var(--fbh-space-xl);
  align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 56rem) {
  .fbh-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fbh-split--lead { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
  .fbh-split--aside { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; }
  .fbh-split--flip > :first-child { order: 2; }
}

.fbh-stack > * + * { margin-top: var(--fbh-space-m); }
