/* Synergy Re block theme. Loaded on the front end and in the editor iframe.
   Base typography, colours, links and buttons come from theme.json; this file
   adds what theme.json cannot express. Values come only from generated
   presets (WordPress names: heading sizes are --font-size--h-2/h-3/h-4).
   Selectors target core block markup, block-style classes and the section
   classes saved in content, never prototype-only wrappers.
   scripts/check-css.mjs forbids literal colours and font sizes here. */

/* ---------- Base ---------- */
html {
  /* Keeps focused controls clear of the sticky header (WCAG 2.4.11, P04). */
  scroll-padding-block-start: calc(var(--wp--custom--control--nav-height) + var(--wp-admin--admin-bar--height, 0px) + var(--wp--preset--spacing--30));
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

h1, h2, h3, h4 { text-wrap: balance; }

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover { text-decoration-thickness: 2px; }

@media (prefers-reduced-motion: no-preference) {
  a, .wp-block-button__link {
    transition: color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
      background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
      border-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
  }
}

:focus-visible {
  outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--primary-deep);
  outline-offset: var(--wp--custom--focus--offset);
}

main:focus { outline: none; }

/* Sticky header must never hide a jumped-to heading or a focused control. */
[id] {
  scroll-margin-block-start: calc(var(--wp--custom--control--nav-height) + var(--wp-admin--admin-bar--height, 0px) + var(--wp--preset--spacing--40));
}

p.has-lead-font-size { max-inline-size: var(--wp--custom--measure--lead); }

/* Header, main and footer touch; the global block gap is for content. */
.wp-site-blocks > footer { margin-block-start: 0; }

/* ---------- Header ---------- */
/* Sticky only when the header is compact (JS disclosure or wide screens). The
   no-JS mobile header wraps to two rows and would hide jumped-to headings. */
.wp-site-blocks > header:has(> .sr-header) {
  position: relative;
  inset-block-start: var(--wp-admin--admin-bar--height, 0px);
  z-index: 50;
}

.js .wp-site-blocks > header:has(> .sr-header) { position: sticky; }

@media (min-width: 64rem) {
  .wp-site-blocks > header:has(> .sr-header) { position: sticky; }
}

.sr-header { border-block-end: var(--wp--custom--border--hairline) solid var(--wp--preset--color--border); }

.sr-header__inner.sr-header__inner {
  min-block-size: var(--wp--custom--control--nav-height);
  row-gap: 0;
}

/* Wordmark: "Synergy" in the core Bold format, "Re" in the core colour format. */
.sr-header__inner > p:first-child,
.sr-footer p.has-h-3-font-size {
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

/* inline-block, not flex: flex would drop the space between "Synergy" and "Re". */
.sr-header__inner > p:first-child a {
  display: inline-block;
  line-height: var(--wp--custom--control--min-target);
  color: var(--wp--preset--color--ink);
  text-decoration: none;
}

.sr-header__inner > p:first-child mark,
.sr-footer p.has-h-3-font-size mark { font-weight: var(--wp--custom--font-weight--regular); }

/* Section menu: core/navigation (overlayMenu "never") + section-nav.js (D23). */
.sr-tabs.wp-block-navigation .wp-block-navigation__container { gap: 0 var(--wp--preset--spacing--10); }

.sr-tabs.wp-block-navigation .wp-block-navigation-item__content {
  display: flex;
  align-items: center;
  min-block-size: var(--wp--custom--control--min-target);
  padding-inline: var(--wp--preset--spacing--30);
  border-block-end: var(--wp--custom--border--accent) solid transparent;
  color: var(--wp--preset--color--text);
  font-size: var(--wp--preset--font-size--small);
  font-weight: var(--wp--custom--font-weight--medium);
  line-height: 1.2;
  text-decoration: none;
}

.sr-tabs.wp-block-navigation .wp-block-navigation-item__content:hover {
  color: var(--wp--preset--color--primary);
  border-block-end-color: var(--wp--preset--color--border);
}

.sr-tabs.wp-block-navigation .wp-block-navigation-item__content[aria-current] {
  color: var(--wp--preset--color--ink);
  border-block-end-color: var(--wp--preset--color--primary);
}

@media (min-width: 64rem) {
  .sr-header__inner.sr-header__inner { flex-wrap: nowrap; }
  .sr-tabs.wp-block-navigation .wp-block-navigation-item__content {
    min-block-size: var(--wp--custom--control--nav-height);
    font-size: var(--wp--preset--font-size--base);
  }
}

/* Menu button (rendered by functions.php, hidden without JS). */
.sr-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--wp--preset--spacing--20);
  min-block-size: var(--wp--custom--control--min-target);
  padding-inline: var(--wp--preset--spacing--40);
  border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--border);
  border-radius: var(--wp--custom--radius--control);
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--ink);
  font: inherit;
  font-weight: var(--wp--custom--font-weight--medium);
  cursor: pointer;
}

.sr-menu-toggle[hidden] { display: none; }

.sr-menu-toggle__icon,
.sr-menu-toggle__icon::before,
.sr-menu-toggle__icon::after {
  display: block;
  inline-size: 1.125rem;
  block-size: 2px;
  background: currentColor;
}

.sr-menu-toggle__icon { position: relative; }
.sr-menu-toggle__icon::before, .sr-menu-toggle__icon::after { content: ""; position: absolute; }
.sr-menu-toggle__icon::before { inset-block-start: -6px; }
.sr-menu-toggle__icon::after { inset-block-start: 6px; }
.sr-menu-toggle[aria-expanded="true"] .sr-menu-toggle__icon { background: transparent; }
.sr-menu-toggle[aria-expanded="true"] .sr-menu-toggle__icon::before { inset-block-start: 0; transform: rotate(45deg); }
.sr-menu-toggle[aria-expanded="true"] .sr-menu-toggle__icon::after { inset-block-start: 0; transform: rotate(-45deg); }

/* Collapsed state is CSS-first (keyed on the inline-set .js class), so the
   menu does not render open and then jump shut (P04 CLS fix). */
@media (max-width: 63.999rem) {
  .js .sr-menu-toggle[hidden] { display: inline-flex; }
  .js .sr-header__inner > .sr-tabs { flex-basis: 100%; }
  .js .sr-header__inner > .sr-tabs:not([data-open]) { display: none; }
  .js .sr-header__inner > .sr-tabs .wp-block-navigation__container {
    flex-direction: column;
    align-items: stretch;
    inline-size: 100%;
    padding-block: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
  }
  .js .sr-header__inner > .sr-tabs.wp-block-navigation .wp-block-navigation-item__content {
    border-block-end: 0;
    border-inline-start: var(--wp--custom--border--accent) solid transparent;
    font-size: var(--wp--preset--font-size--base);
  }
  .js .sr-header__inner > .sr-tabs.wp-block-navigation .wp-block-navigation-item__content[aria-current] {
    border-inline-start-color: var(--wp--preset--color--primary);
  }
}

@media (min-width: 64rem) {
  .sr-menu-toggle { display: none; }
}

/* ---------- Sections ---------- */
.sr-section h2 { max-inline-size: var(--wp--custom--measure--lead); }

/* ---------- Hero ---------- */
.is-style-hero {
  display: grid;
  align-items: center;
  min-block-size: var(--wp--custom--hero--min-block-size);
}

/* As a grid item the wide group would shrink to its text and centre; keep it
   at the wide width so the text starts at the page edge (line art removed, CR01). */
.is-style-hero .sr-hero__inner { inline-size: 100%; }
.is-style-hero h1 { max-inline-size: var(--wp--custom--measure--headline); }

/* On the purple hero a purple fill disappears; invert it (inverse on white: 10.86:1). */
.is-style-hero .wp-block-button > .wp-block-button__link {
  background: var(--wp--preset--color--on-inverse);
  border-color: var(--wp--preset--color--on-inverse);
  color: var(--wp--preset--color--inverse);
}

.is-style-hero .wp-block-button > .wp-block-button__link:hover {
  background: var(--wp--preset--color--on-inverse-muted);
  border-color: var(--wp--preset--color--on-inverse-muted);
  color: var(--wp--preset--color--inverse);
}

.is-style-hero .wp-block-button.is-style-outline > .wp-block-button__link {
  background: transparent;
  border-width: var(--wp--custom--border--hairline);
  border-color: var(--wp--preset--color--on-inverse);
  color: var(--wp--preset--color--on-inverse);
  padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
}

.is-style-hero .wp-block-button.is-style-outline > .wp-block-button__link:hover {
  background: var(--wp--preset--color--on-inverse);
  color: var(--wp--preset--color--inverse);
}

.is-style-hero .wp-block-button__link { min-block-size: var(--wp--custom--control--min-target); }

@media (max-width: 29.999rem) {
  .is-style-hero .wp-block-button { flex: 1 1 100%; }
  .is-style-hero .wp-block-button__link { inline-size: 100%; }
}

.is-style-hero :focus-visible { outline-color: var(--wp--preset--color--on-inverse); }

/* ---------- About: statements and values ---------- */
.sr-statement {
  padding-block: var(--wp--preset--spacing--50);
  border-block-start: var(--wp--custom--border--hairline) solid var(--wp--preset--color--border);
}

.sr-statement:first-child { padding-block-start: 0; border-block-start: 0; }

.sr-values .alignwide > p { max-inline-size: var(--wp--custom--measure--body); }

.sr-value {
  padding-inline-start: var(--wp--preset--spacing--40);
  border-inline-start: var(--wp--custom--border--accent) solid var(--wp--preset--color--border);
}

.sr-value.is-style-core-value { border-inline-start-color: var(--wp--preset--color--primary); }

/* ---------- Services, specialties, capabilities ---------- */
.is-style-top-rule {
  padding-block-start: var(--wp--preset--spacing--50);
  border-block-start: var(--wp--custom--border--accent) solid var(--wp--preset--color--primary);
}

.is-style-separated {
  padding-block-start: var(--wp--preset--spacing--40);
  border-block-start: var(--wp--custom--border--hairline) solid var(--wp--preset--color--border);
}

.sr-capability::before {
  content: "";
  display: block;
  inline-size: var(--wp--preset--spacing--60);
  block-size: var(--wp--custom--border--accent);
  margin-block-end: var(--wp--preset--spacing--30);
  background: var(--wp--preset--color--primary);
}

/* ---------- Team profiles ---------- */
.is-style-profile {
  padding: var(--wp--preset--spacing--50);
  border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--border);
  border-radius: var(--wp--custom--radius--card);
  background: var(--wp--preset--color--surface);
}

.is-style-profile > .sr-profile__head + * { margin-block-start: var(--wp--preset--spacing--50); }

.sr-profile__portrait.sr-profile__portrait { flex: none; margin: 0; }

.sr-profile__portrait img {
  inline-size: var(--wp--custom--portrait--size);
  block-size: var(--wp--custom--portrait--size);
  aspect-ratio: var(--wp--custom--portrait--ratio);
  object-fit: var(--wp--custom--portrait--fit);
  border-radius: var(--wp--custom--radius--portrait);
}

.sr-profile__head p { font-weight: var(--wp--custom--font-weight--medium); }

/* Contact label uses the core Bold format, styled as a quiet label (R01 F10). */
.is-style-profile > p strong {
  display: inline-block;
  min-inline-size: 4.25rem;
  font-weight: var(--wp--custom--font-weight--regular);
  color: var(--wp--preset--color--text-muted);
  font-size: var(--wp--preset--font-size--small);
}

/* break-word wraps the whole address first instead of splitting the domain (R01 F7). */
.is-style-profile a[href^="mailto:"] { overflow-wrap: break-word; }

/* ---------- Contact ---------- */

/* ---------- Footer ---------- */
.sr-footer :focus-visible { outline-color: var(--wp--preset--color--on-inverse); }
.sr-footer p { margin: 0; }

/* ---------- Print ---------- */
@media print {
  .wp-site-blocks > header, .sr-contact__toggle { display: none; }
  .is-style-hero, .has-surface-subtle-background-color, .sr-footer { background: none; }
  .is-style-hero *, .sr-footer * { color: inherit; }
  .is-style-profile a::after { content: " (" attr(href) ")"; }
}

/* ---------- Contact (CR01) ----------
   Two cards side by side, each with a logo slot, details and its own form.
   Office lines carry round icon badges drawn in CSS: a primary circle and a
   masked on-inverse icon, so no icon font or image request. */
.sr-contact__layout { align-items: start; }
/* Logo slot at the top of each card; until a logo is set, a card without a
   title shows its company name as text in the title style. */
.sr-contact__logo { margin: 0; }
.sr-contact__logo img, img.sr-contact__logo { display: block; inline-size: auto; max-inline-size: min(16rem, 100%); max-block-size: 7rem; block-size: auto; }
.sr-contact__logo-text {
  margin: 0;
  color: var(--wp--preset--color--primary);
  font-size: var(--wp--preset--font-size--h-2);
  font-weight: var(--wp--custom--font-weight--bold);
  line-height: var(--wp--custom--line-height--tight);
}

.sr-contact__name { margin: 0; color: var(--wp--preset--color--primary); font-size: var(--wp--preset--font-size--h-2); }
.sr-contact__details { display: grid; gap: var(--wp--preset--spacing--50); }
.sr-contact__card [hidden] { display: none !important; }
/* The toggle becomes a <button> in JS; browsers reset its font. */
.sr-contact__toggle button { font-family: inherit; cursor: pointer; }

.sr-office-line {
  position: relative;
  display: flex;
  align-items: center;
  min-block-size: 3.5rem;
  margin: 0;
  padding-inline-start: calc(3.5rem + var(--wp--preset--spacing--50));
}
.sr-office-line p { margin: 0; }
.sr-office-line::before, .sr-office-line::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  translate: 0 -50%;
}
.sr-office-line::before {
  inset-inline-start: 0;
  inline-size: 3.5rem;
  block-size: 3.5rem;
  border-radius: 50%;
  background: var(--wp--preset--color--primary);
}
.sr-office-line::after {
  inset-inline-start: 0.875rem;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  background: var(--wp--preset--color--on-inverse);
  mask: var(--sr-icon) center / contain no-repeat;
}
.sr-office-line.is-location { --sr-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2a7 7 0 0 0-7 7c0 5.25 7 13 7 13s7-7.75 7-13a7 7 0 0 0-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z'/></svg>"); }
.sr-office-line.is-phone { --sr-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6.62 10.79a15.05 15.05 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.02-.24c1.12.37 2.32.57 3.57.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.25 1.02z'/></svg>"); }
.sr-office-line.is-email { --sr-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8'><rect x='3' y='5' width='18' height='14' rx='2'/><path d='m3.5 6.5 8.5 6.5 8.5-6.5'/></svg>"); }
.sr-office-line strong, .sr-office-line a {
  color: var(--wp--preset--color--primary);
  font-size: var(--wp--preset--font-size--lead);
  font-weight: var(--wp--custom--font-weight--bold);
  overflow-wrap: break-word;
}
.sr-contact__address, .sr-contact__address p { margin: 0; color: var(--wp--preset--color--ink); }

/* Message form: two fields per row from 40rem, message and submit full width.
   The same rules style the prototype preview and Contact Form 7's markup. */
.sr-contact__form .wpcf7-form { display: grid; gap: var(--wp--preset--spacing--40); }
.sr-form { display: grid; gap: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50); margin: 0; }
.sr-form p { margin: 0; }
.sr-form__field label { display: block; }
.sr-form__label { display: block; margin-block-end: var(--wp--preset--spacing--10); font-weight: var(--wp--custom--font-weight--medium); }
.sr-form input:not([type="submit"]), .sr-form textarea {
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: var(--wp--custom--control--min-target);
  padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
  border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--text-muted);
  border-radius: var(--wp--custom--radius--control);
  background: var(--wp--preset--color--surface);
  color: var(--wp--preset--color--ink);
  font: inherit;
}
.sr-form textarea { resize: vertical; }
.sr-form :disabled { cursor: not-allowed; }
.sr-form__note { color: var(--wp--preset--color--text-muted); font-size: var(--wp--preset--font-size--small); }
@media (min-width: 40rem) {
  .sr-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sr-form__field--wide, .sr-form__submit, .sr-form__note { grid-column: 1 / -1; }
}

/* Contact Form 7 states, in theme colours (its own red fails on the band). */
.sr-contact__form .wpcf7-not-valid-tip {
  margin-block-start: var(--wp--preset--spacing--10);
  color: var(--wp--preset--color--primary-deep);
  font-size: var(--wp--preset--font-size--small);
  font-weight: var(--wp--custom--font-weight--medium);
}
.sr-contact__form .wpcf7-not-valid { border-color: var(--wp--preset--color--primary-deep); border-width: 2px; }
.sr-contact__form .wpcf7 form .wpcf7-response-output {
  margin: var(--wp--preset--spacing--40) 0 0;
  padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
  border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--primary);
  border-radius: var(--wp--custom--radius--control);
}
.sr-contact__fallback a { font-weight: var(--wp--custom--font-weight--bold); }
