/*
Theme Name:   GM Bricklaying
Theme URI:    https://gmbricklaying.ie
Description:  One-page site for GM Bricklaying Limited, Dublin. Ollie child theme.
              Sections are unsynced block patterns so they can be reordered or
              removed in the site editor without touching code.
Author:       Frank Keane
Template:     ollie
Version:      1.0.0
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.1
Text Domain:  gm-bricklaying
*/

/* ==========================================================================
   1. OLLIE TOKEN SHIM  — read this before changing theme.json
   --------------------------------------------------------------------------
   A child theme's settings arrays SUPERSEDE the parent's wholesale; WordPress
   does not merge them slug by slug. GM's palette shares no slug with Ollie's:

       colour       11 Ollie slugs, 0 shared
       spacing       7 Ollie slugs, 0 shared
       font size     7 Ollie slugs, 2 shared ('base', 'small' — DIFFERENT values)
       font family   5 Ollie slugs, 0 shared

   Ollie loads its block CSS with wp_enqueue_block_style(), i.e. per block
   actually present on the page, and that CSS makes 58 references to the vars
   above (spacing--medium x27, spacing--small x22, font-size--small x22,
   font-size--x-small x16, spacing--large x9 ...). With the vars unemitted those
   declarations are invalid at computed-value time and silently fall back —
   which shows up as drifted padding on core blocks, not as an error.

   Fix: re-declare Ollie's slugs as plain custom properties mapped to GM values.
   They resolve Ollie's stylesheets. They are NOT palette entries, so they never
   appear in Gavin's colour or spacing pickers — he still sees exactly the 20
   GM swatches and the 6-step 8px scale.

   Do not "tidy" this block away because nothing looks broken. Nothing looks
   broken because this block is here.
   ========================================================================== */

:root {
	/* colour — Ollie slug : nearest GM token */
	--wp--preset--color--base:               var(--wp--preset--color--limestone);
	--wp--preset--color--main:               var(--wp--preset--color--ink);
	--wp--preset--color--main-accent:        var(--wp--preset--color--rule);
	--wp--preset--color--primary:            var(--wp--preset--color--oxide);
	--wp--preset--color--primary-accent:     var(--wp--preset--color--card);
	--wp--preset--color--primary-alt:        var(--wp--preset--color--oxide-dark);
	--wp--preset--color--primary-alt-accent: var(--wp--preset--color--graphite);
	--wp--preset--color--secondary:          var(--wp--preset--color--body-soft);
	--wp--preset--color--tertiary:           var(--wp--preset--color--card);
	--wp--preset--color--border-light:       var(--wp--preset--color--rule);
	--wp--preset--color--border-dark:        var(--wp--preset--color--ink-rule);

	/* spacing — Ollie's fluid steps re-cut on GM's 8px scale (8·16·24·40·64·96) */
	--wp--preset--spacing--small:       clamp(8px, 2.5vw, 16px);
	--wp--preset--spacing--medium:      clamp(16px, 4vw, 24px);
	--wp--preset--spacing--large:       clamp(24px, 5vw, 40px);
	--wp--preset--spacing--x-large:     clamp(40px, 7vw, 64px);
	--wp--preset--spacing--xx-large:    clamp(64px, 9vw, 96px);
	--wp--preset--spacing--xxx-large:   clamp(64px, 12vw, 96px);
	--wp--preset--spacing--xxxx-large:  clamp(64px, 14vw, 96px);

	/* font size — the 5 Ollie slugs GM does not redefine.
	   'base' and 'small' are deliberately NOT listed: GM redefines both
	   (16px / 15px vs Ollie's 1.165rem / 1.05rem) and GM's values win. */
	--wp--preset--font-size--x-small:  var(--wp--preset--font-size--caption);
	--wp--preset--font-size--medium:   var(--wp--preset--font-size--h-3);
	--wp--preset--font-size--large:    var(--wp--preset--font-size--h-2);
	--wp--preset--font-size--x-large:  var(--wp--preset--font-size--h-2);
	--wp--preset--font-size--xx-large: var(--wp--preset--font-size--h-1);

	/* font family — Ollie ships Mona Sans in four widths. GM uses Archivo only. */
	--wp--preset--font-family--primary:   var(--wp--preset--font-family--archivo);
	--wp--preset--font-family--expanded:  var(--wp--preset--font-family--archivo);
	--wp--preset--font-family--condensed: var(--wp--preset--font-family--archivo);
	--wp--preset--font-family--narrow:    var(--wp--preset--font-family--archivo);
	--wp--preset--font-family--monospace: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ==========================================================================
   2. SQUARE CORNERS, NO SHADOWS
   Brick is laid square. theme.json zeroes radius on the 15 blocks we use;
   this catches Ollie's own stylesheets, which hardcode px radii outside
   theme.json's reach (core-image .is-style-rounded = 10px, code = 5px).
   ========================================================================== */

.wp-block-image.is-style-rounded img,
.wp-block-image .is-style-rounded img,
.wp-block-image.is-style-rounded-full img,
.wp-block-image .is-style-rounded-full img,
.is-style-media-boxed,
.wp-block-code,
.wp-block-preformatted { border-radius: 0; }

.is-style-media-boxed img { box-shadow: none; }

/* ==========================================================================
   3. TYPE RULES THAT HAVE NO theme.json SURFACE
   ========================================================================== */

h1, h2, h3, .gm-eyebrow { text-wrap: balance; }
p, li, figcaption          { text-wrap: pretty; }

/* Uppercase is for H1, H2 and labels. Never a sentence. */
.gm-eyebrow {
	font-size: var(--wp--preset--font-size--label-lg);
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	line-height: 1.3;
}

.gm-label {
	font-size: var(--wp--preset--font-size--label);
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	line-height: 1.3;
}

/* Trust bar and process numbers align on the digit. */
.gm-trust__list,
.gm-process__num,
.gm-figure-count { font-variant-numeric: tabular-nums; }

/* Measure caps. Body copy is capped 46-66ch depending on context.
   Applied as a className, never an inline style: an inline style that the
   block's own attributes do not declare fails block validation and the editor
   shows "This block contains unexpected or invalid content." */
.gm-measure-tight, .gm-measure-tight > p { max-width: var(--wp--custom--measure--tight); }
.gm-measure-body,  .gm-measure-body  > p { max-width: var(--wp--custom--measure--body); }
.gm-measure-wide,  .gm-measure-wide  > p { max-width: var(--wp--custom--measure--wide); }
.gm-measure-prose, .gm-measure-prose > p { max-width: var(--wp--custom--measure--prose); }
