/* ===========================================================================
   VGS Group — reset, base typography, layout primitives
   =========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* A safety net only. The off-canvas panel is removed from layout when
     closed, which is what actually prevents sideways scrolling; this catches
     anything else that oversteps. clip rather than hidden, because hidden on
     the root creates a scroll container and stops position: sticky working. */
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: var(--tracking-display);
  margin: 0 0 var(--space-s);
  /* Even line lengths, and never a single word on the last line. */
  text-wrap: balance;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); }
h5 { font-size: var(--step-1); }
h6 { font-size: var(--step-0); text-transform: uppercase; letter-spacing: var(--tracking-caps); }

/*
 * Page headings are set with every word capitalised, and it is enforced here
 * rather than left to the editor -- the client types headings, and consistency
 * across a dozen of them is exactly what does not survive that. capitalize
 * raises the first letter of each word and leaves existing capitals alone, so
 * VGS stays VGS rather than becoming Vgs.
 *
 * Two headings are deliberately left alone. A blog title is a sentence, and
 * reads as broken English word-capped; the search heading is the visitor's own
 * query echoed back, which is theirs to capitalise, not ours.
 */
h1,
h2,
.hero__title,
.page-hero__title { text-transform: capitalize; }

/* The exceptions are all sentences rather than headings: a blog title and its
   subheadings, a listing entry, and the search heading, which is the visitor's
   own query echoed back. A page's own subheadings are not excluded -- those are
   headings the client writes, and they are the reason this rule exists. */
.post-hero .page-hero__title,
body.search .page-hero__title,
.post-card__title,
.entry__title,
body.single-post .entry__content h2 { text-transform: none; }

/* text-wrap: pretty keeps a lone word off the last line of running text in
   browsers that support it; the non-breaking bind applied to headings in PHP
   covers the rest. */
p, li, dd, blockquote, figcaption { text-wrap: pretty; }

p { margin: 0 0 var(--space-s); max-width: var(--measure); }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* Focus. The brand carries no accent colour, so focus reads through weight and
   offset. Both variants must clear 3:1 against their ground. */
:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 2px;
}
.u-inverse :focus-visible,
.u-deep :focus-visible { outline-color: var(--focus-ring-inverse); }

/* --- Accessibility helpers ------------------------------------------------ */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-s); top: var(--space-s);
  z-index: 999;
  padding: var(--space-2xs) var(--space-s);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* --- Layout primitives ---------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }


/* --- Tone ----------------------------------------------------------------- */
.u-inverse {
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
.u-inverse :is(h1,h2,h3,h4,h5,h6) { color: var(--text-inverse); }
.u-deep { background: var(--surface-deep); color: var(--text-inverse); }
.u-raised { background: var(--surface-raised); }

.u-eyebrow {
  font-family: var(--font-display);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-muted);
  margin-bottom: var(--space-2xs);
  /* An eyebrow is a short label, never a paragraph of running text. Without
     this it inherits the global measure and, in a centred section, centres
     inside that narrow box instead of the section. */
  max-width: none;
}

/* u-deep as well as u-inverse: the divisions section is a black band, and
   without this its eyebrow inherits the light-mode muted charcoal, landing at
   3.39:1 on VGS Black where 4.5:1 is required. Silver is the brand's own
   inverse muted tone, so this corrects the pairing rather than introducing a
   colour. */
.u-inverse .u-eyebrow,
.u-deep .u-eyebrow { color: var(--text-inverse-muted); }

/* --- Buttons -------------------------------------------------------------- */
/* Core button blocks (the patterns' buttons) share the .btn look: the link is
   the button; its wrapper is only a flex item. */
.btn,
.wp-block-button > .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-m);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover,
.wp-block-button > .wp-block-button__link:hover { background: var(--vgs-black); transform: translateY(-2px); }

.btn--ghost,
.wp-block-button.is-style-outline > .wp-block-button__link {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
}
.btn--ghost:hover,
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--surface-inverse); color: var(--text-inverse); }

.wp-block-buttons { display: flex; flex-wrap: wrap; gap: var(--space-s); }

.u-inverse .btn--ghost,
.u-inverse .wp-block-button.is-style-outline > .wp-block-button__link { color: var(--text-inverse); border-color: var(--text-inverse); }
.u-inverse .btn--ghost:hover,
.u-inverse .wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--surface); color: var(--text); }
