/* CRG colour roles: one institutional field, one reading paper, one quiet wash.
   URL palette previews remain alternatives; logos, photographs and atlas land
   colours are deliberately outside this system's recolouring scope. */
body.crg-site {
  --crg-theme-night: var(--palette-night, oklch(23% .045 250));
  --crg-theme-paper: var(--palette-paper, oklch(98.1% .004 244));
  --crg-theme-wash: var(--palette-wash, oklch(95.5% .006 245));
  --crg-theme-ink: oklch(20% .026 244);
  --crg-theme-muted: oklch(42% .032 244);
  --crg-theme-action: var(--palette-accent, oklch(36% .102 250));
  --crg-theme-on-dark: var(--palette-accent-light, oklch(86% .065 245));
  --crg-theme-link-hover: var(--crg-theme-action);
}

@media (forced-colors: none) {
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site {
    --crg-paper: var(--crg-theme-paper);
    --crg-surface: var(--crg-theme-wash);
    --crg-mist-soft: var(--crg-theme-wash);
    --crg-blue-deep: var(--crg-theme-night);
    --crg-link-on-dark: var(--crg-theme-on-dark);
  }
  /* Bind the few legacy hard-coded surfaces to the same roles as other pages. */
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site :is(.crg-atlas, .crg-footer, .crg-section-hero, .crg-publications-hero, .crg-home-stage) {
    background-color: var(--crg-theme-night);
  }
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site :is(.crg-brand-library, .crg-home-flagships, .crg-research-line:nth-child(3)) {
    background: var(--crg-theme-wash); color: var(--crg-theme-ink);
  }
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site :is(.crg-atlas, .crg-section-hero, .crg-home-stage, .crg-publications-hero, .crg-institute-practice, .crg-research-line:nth-child(2), .crg-comms-feature--diffusion, .crg-home-results, .crg-home-field-projects, .crg-projects-next, .crg-projects-intro, .crg-events-archive, .crg-footer) {
    --crg-theme-link-hover: var(--crg-theme-on-dark);
    --crg-link-on-dark: var(--crg-theme-on-dark);
  }
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site :is(.crg-text-link, .crg-evidence-link):is(:hover, :focus-visible) {
    color: var(--crg-theme-link-hover); text-decoration-color: currentColor;
  }
  /* Shared contact is a light utility section, not a second photographic hero. */
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site .crg-contact-hero {
    --contact-surface: var(--crg-theme-wash);
    --contact-ink: var(--crg-theme-ink);
    --contact-muted: var(--crg-theme-muted);
    --contact-action: var(--crg-theme-action);
  }
  /* Homepage chapters need contrast as well as shared brand colours. */
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site .crg-home-story :is(.crg-home-research, .crg-home-latest) {
    background: var(--crg-theme-paper);
  }
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site .crg-home-story .crg-home-community {
    background: var(--palette-wash, oklch(90% .024 245));
  }
  html:not([data-crg-contrast="inverse"]):not([data-crg-contrast="high"]) body.crg-site .crg-home-community .crg-home-flagships {
    background: transparent; color: inherit;
  }
}

.crg-contact-hero {
  --contact-surface: var(--crg-surface);
  --contact-ink: var(--crg-ink);
  --contact-muted: var(--crg-ink-soft);
  --contact-action: var(--crg-ink);
  padding-block: clamp(48px, 6vw, 80px);
  background: var(--contact-surface); color: var(--contact-ink);
  scroll-margin-top: 150px;
}
.crg-contact-hero .crg-contact-hero__grid {
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.65fr);
  align-items: start; gap: 36px clamp(28px, 4vw, 64px);
}
.crg-contact-hero :is(h1, h2) {
  max-width: 15ch; margin: 0; color: var(--contact-ink);
  font-size: clamp(2rem, 3.5vw, 3.2rem); line-height: 1.12;
  letter-spacing: -.035em; text-wrap: balance;
}
.crg-contact-hero__details {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px; border-top: 1px solid var(--crg-line); padding-top: 20px;
}
.crg-contact-hero__details h3 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 18px;
  color: var(--contact-muted); font-size: .9rem; font-weight: 700; line-height: 1.5;
}
.crg-contact-hero__details .crg-icon { width: 20px; height: 20px; flex-basis: 20px; }
.crg-contact-hero address {
  display: grid; gap: 3px; margin: 0; color: var(--contact-ink);
  font-style: normal; font-size: 1rem; line-height: 1.55;
}
.crg-contact-hero address strong { font-weight: 700; font-size: 1.25rem; margin-bottom: 4px; }
.crg-contact-hero address span { color: var(--contact-muted); }
.crg-contact-hero a.crg-contact-hero__action {
  display: inline-flex; align-items: center; gap: 14px; min-height: 44px;
  max-width: 100%; padding-block: 10px; color: var(--contact-action);
  font-size: 1rem; line-height: 1.5; font-weight: 700;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em;
  transition: color 150ms ease-out;
}
.crg-contact-hero__office .crg-contact-hero__action { margin-top: 8px; }
.crg-contact-hero a.crg-contact-hero__email-link { padding-top: 0; align-items: baseline; overflow-wrap: anywhere; }
.crg-contact-hero__action > span[aria-hidden] { flex: 0 0 auto; }
.crg-contact-hero a.crg-contact-hero__action:is(:hover, :focus-visible) {
  color: var(--contact-ink); text-decoration-thickness: 2px;
}
.crg-contact-hero .crg-contact-hero__action:focus-visible {
  outline: 2px solid var(--contact-action); outline-offset: 4px;
  box-shadow: 0 0 0 2px var(--contact-surface);
}
.crg-contact-hero .crg-contact-map {
  grid-column: 1 / -1; height: clamp(440px, 42vw, 600px); min-height: 440px;
  background: var(--crg-paper); border: 1px solid var(--crg-line); overflow: hidden;
}
.crg-contact-hero .crg-contact-map iframe { width: 100%; height: 100%; min-height: 0; filter: none; }
html[data-crg-contrast="inverse"] .crg-contact-hero,
html[data-crg-contrast="high"] .crg-contact-hero {
  --contact-surface: var(--crg-surface); --contact-ink: var(--crg-ink);
  --contact-muted: var(--crg-ink-soft); --contact-action: var(--crg-ink);
}
@media (max-width: 1000px) {
  .crg-contact-hero .crg-contact-hero__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .crg-contact-hero :is(h1, h2) { max-width: 24ch; }
  .crg-contact-hero__details { gap: 32px; }
}
@media (max-width: 580px) {
  .crg-contact-hero__details { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .crg-contact-hero__email { border-top: 1px solid var(--crg-line); padding-top: 20px; }
  .crg-contact-hero__details h3 { margin-bottom: 12px; }
  .crg-contact-hero .crg-contact-map { height: 440px; }
}
@media (prefers-reduced-motion: reduce) { .crg-contact-hero a.crg-contact-hero__action { transition: none; } }
@media (forced-colors: active) {
  .crg-contact-hero { --contact-surface: Canvas; --contact-ink: CanvasText; --contact-muted: CanvasText; --contact-action: LinkText; }
  .crg-contact-hero :is(.crg-contact-hero__details, .crg-contact-hero__email, .crg-contact-map) { border-color: CanvasText; }
  .crg-contact-hero .crg-contact-hero__action:focus-visible { outline-color: Highlight; box-shadow: none; }
}
