/* AMG homepage refinement — 2026-09-20
 * Load AFTER amg-rounded-system-v5. Remove this file's loader to roll back.
 * Scope requires the existing WordPress home + amg-v4 body classes.
 * Geometry, breakpoints, image crops, font families/sizes and content stay intact.
 * Targeted !important declarations beat the existing V7 presentation guards.
 */
body.home.amg-v4 {
  --amg-ref-paper: #f7f5f0;
  --amg-ref-navy: #14283d;
  --amg-ref-ink: #202c38;
  --amg-ref-muted: #59636d;
  --amg-ref-line: #dedfdc;
  --amg-ref-red: #b92336;
  --amg-ref-shadow: 0 4px 16px rgba(20,40,61,.045);
  background-color: var(--amg-ref-paper);
  color: var(--amg-ref-ink);
}

/* Warm page canvas; preserve existing module spacing and column alignment. */
body.home.amg-v4 .ed-hero,
body.home.amg-v4 .ed-cta { background: var(--amg-ref-paper); }
body.home.amg-v4 .ed-header,
body.home.amg-v4 .ed-utility,
body.home.amg-v4 .ed-footer,
body.home.amg-v4 .ed-cta .ed-shell {
  background: var(--amg-ref-navy);
  color: #fff;
  border-color: #34465a;
}
body.home.amg-v4 .ed-footer small { color: #c8d0d8; }
body.home.amg-v4 .ed-search { border-color: #526173; }
body.home.amg-v4 .ed-nav a:hover,
body.home.amg-v4 .ed-search:hover,
body.home.amg-v4 .ed-footer a:hover { color: #fff; background: #304458; }

/* Restrained corners and softer borders, including mobile guardrails. */
body.home.amg-v4 .amg-top-story,
body.home.amg-v4 #latest .ed-update,
body.home.amg-v4 #watch .ed-video,
body.home.amg-v4 #services .ed-service,
body.home.amg-v4 .ed-panel,
body.home.amg-v4 .ed-side-card {
  border-radius: 12px !important;
  border-color: var(--amg-ref-line) !important;
  box-shadow: var(--amg-ref-shadow) !important;
}
body.home.amg-v4 .ed-module,
body.home.amg-v4 #watch,
body.home.amg-v4 #services,
body.home.amg-v4 .ed-bottom-grid > div,
body.home.amg-v4 .ed-cta .ed-shell,
body.home.amg-v4 .ed-footer {
  border-radius: 16px !important;
  border-color: var(--amg-ref-line) !important;
  box-shadow: none;
}
body.home.amg-v4 .ed-bottom-grid > div { background: #f0eee8; }
body.home.amg-v4 .ed-event { border-color: var(--amg-ref-line); border-radius: 8px; }
body.home.amg-v4 .ed-module-head,
body.home.amg-v4 #services .ed-services-head { border-color: var(--amg-ref-line) !important; }

/* Typography keeps its current metrics to protect line wraps and the fold. */
body.home.amg-v4 .amg-top-title,
body.home.amg-v4 .amg-top-title h1,
body.home.amg-v4 .amg-top-title h2,
body.home.amg-v4 #latest .ed-update h3,
body.home.amg-v4 #watch .ed-video h3,
body.home.amg-v4 #services .ed-service h3,
body.home.amg-v4 #services .ed-services-head h2,
body.home.amg-v4 .ed-bottom-grid h3 { color: var(--amg-ref-ink) !important; }
body.home.amg-v4 .amg-top-excerpt,
body.home.amg-v4 .amg-top-footer .ed-meta,
body.home.amg-v4 #services .ed-service p,
body.home.amg-v4 #services .ed-services-head > p,
body.home.amg-v4 .ed-module-head p { color: var(--amg-ref-muted) !important; }
body.home.amg-v4 .ed-module-head h2,
body.home.amg-v4 .ed-panel-title {
  color: var(--amg-ref-navy) !important;
  background-color: #eeece6;
  border-radius: 6px;
}
body.home.amg-v4 #watch .ed-module-head h2 {
  background: #eeece6 !important;
  color: var(--amg-ref-navy) !important;
  border-radius: 6px !important;
}
body.home.amg-v4 #latest .ed-update small,
body.home.amg-v4 #services .ed-services-kicker,
body.home.amg-v4 #services .ed-services-head h2 span { color: var(--amg-ref-red) !important; }

/* Controlled red actions; existing circular arrows/play controls remain circular. */
body.home.amg-v4 .ed-button,
body.home.amg-v4 #latest .ed-module-head > a,
body.home.amg-v4 #latest .ed-module-head > a:visited,
body.home.amg-v4 #watch .ed-module-head > a,
body.home.amg-v4 #services .ed-services-all,
body.home.amg-v4 .amg-top-copy .ed-label,
body.home.amg-v4 .ed-date {
  background: var(--amg-ref-red) !important;
  border-color: var(--amg-ref-red) !important;
  color: #fff !important;
  border-radius: 7px !important;
  box-shadow: none !important;
}
body.home.amg-v4 .amg-top-arrow { background: #eeece6; color: var(--amg-ref-red) !important; }
body.home.amg-v4 .amg-top-story-main .amg-top-arrow,
body.home.amg-v4 #services .ed-arrow,
body.home.amg-v4 #services .ed-service h3::after {
  background: var(--amg-ref-red) !important;
  box-shadow: none !important;
}
body.home.amg-v4 .amg-top-story-main .amg-top-arrow { color: #fff !important; }
body.home.amg-v4 .ed-button:hover,
body.home.amg-v4 #latest .ed-module-head > a:hover,
body.home.amg-v4 #watch .ed-module-head > a:hover,
body.home.amg-v4 #services .ed-services-all:hover,
body.home.amg-v4 .amg-top-arrow:hover,
body.home.amg-v4 #services .ed-service:hover .ed-arrow {
  background: var(--amg-ref-navy) !important;
  border-color: var(--amg-ref-navy) !important;
  color: #fff !important;
}

/* Keep photographs natural and preserve their current crop, size and positioning. */
body.home.amg-v4 .amg-top-image { background: #eeece6; }
body.home.amg-v4 .ed-side-card > div {
  background: rgba(20,40,61,.88);
  border-radius: 10px;
}
body.home.amg-v4 #watch .ed-play { background: rgba(20,40,61,.86) !important; }

/* Visible keyboard focus on both ivory and navy surfaces; no layout displacement. */
body.home.amg-v4 .ed-header a:focus-visible,
body.home.amg-v4 #main-content a:focus-visible,
body.home.amg-v4 .ed-footer a:focus-visible {
  outline: 3px solid var(--amg-ref-red);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #fff !important;
}

/* Shared full footer */
body.home.amg-v4 .site-footer{background:#14283d;color:#fff;padding:52px 0 30px;border-top:1px solid #34485c}
body.home.amg-v4 .site-footer .wrap{width:min(1180px,calc(100% - 40px));margin-inline:auto}
body.home.amg-v4 .site-footer .footer-grid{display:grid;grid-template-columns:1.2fr .6fr .8fr 1fr;gap:40px}
body.home.amg-v4 .site-footer img.footer-logo-optimized{width:min(230px,100%);height:auto;object-fit:contain}
body.home.amg-v4 .site-footer p,body.home.amg-v4 .site-footer a{color:#c8d0d8;font:14px/1.65 Arial,sans-serif}
body.home.amg-v4 .site-footer h3{color:#fff;font:700 15px/1.4 Arial,sans-serif}
body.home.amg-v4 .site-footer a{overflow-wrap:anywhere}
body.home.amg-v4 .site-footer .footer-links{padding:0;list-style:none}
body.home.amg-v4 .site-footer .footer-links li{margin:8px 0}
body.home.amg-v4 .site-footer .footer-bottom{display:flex;flex-wrap:wrap;justify-content:space-between;gap:16px;border-top:1px solid #34485c;padding-top:24px;margin-top:40px;color:#c8d0d8}
@media(max-width:900px){body.home.amg-v4 .site-footer .footer-grid{grid-template-columns:1fr 1fr}}
@media(max-width:600px){body.home.amg-v4 .site-footer .footer-grid{grid-template-columns:1fr}}

/* Review fixes: shared between homepage and internal refinement sheets. */
body.home.amg-v4 #services .ed-services-kicker {
  display:block !important; margin:0 0 14px !important; line-height:1.4 !important;
}
body.home.amg-v4 #services .ed-services-head h2 {
  margin-top:0 !important; line-height:1.12 !important;
}
body.home.amg-v4 #services .ed-services-head>div { min-width:0; }

/* Preserve the complete creative and the plugin's responsive picture sources. */
body:is(.amg-site-refinement,.home.amg-v4) .amg-ad .amg-ad__creative,
body:is(.amg-site-refinement,.home.amg-v4) .amg-ad .amg-ad__link {
  height:auto !important; max-height:none !important; aspect-ratio:auto !important;
}
body:is(.amg-site-refinement,.home.amg-v4) .amg-ad img.amg-ad__image,
body:is(.amg-site-refinement,.home.amg-v4) .amg-sponsored-ad img {
  width:100% !important; height:auto !important; max-height:none !important;
  aspect-ratio:auto !important; object-fit:contain !important;
  object-position:center !important; transform:none !important;
}
body.amg-site-refinement .nav-list>li>a { white-space:nowrap !important; }
body.amg-site-refinement .article-header .byline,
body.amg-site-refinement .article-header .byline :is(strong,span,a) {
  color:#e7edf3 !important;
}

/* Card headlines only: leave the lead H1 and full article title intact. */
body.home.amg-v4 .amg-top-story:not(.amg-top-story-main) .amg-top-title h2,
body.home.amg-v4 #latest .ed-update h3,
body.home.amg-v4 #watch .ed-video h3,
body.amg-site-refinement .story-copy h3,
body.amg-site-refinement .article-related-grid h3 {
  display:-webkit-box !important; -webkit-box-orient:vertical !important;
  -webkit-line-clamp:2 !important; white-space:normal !important;
  word-break:normal !important; overflow-wrap:normal !important;
  overflow:hidden !important; text-overflow:ellipsis;
}
body.amg-site-refinement .story-copy h3>a,
body.amg-site-refinement .article-related-grid h3>a {
  white-space:normal; word-break:normal; overflow-wrap:normal;
}
body.home.amg-v4 #services .ed-service .ed-arrow,
body.home.amg-v4 #services .ed-service:hover .ed-arrow,
body.home.amg-v4 #services .ed-service:focus-within .ed-arrow {
  background:#b92336 !important;
}

/* Page-review corrections: explicit foreground/background pairs. */
body.amg-site-refinement .story-grid .story-card .story-copy h3,
body.amg-site-refinement .story-grid .story-card .story-copy h3 a {
  color:#202c38 !important;
}
body.amg-site-refinement .story-grid .story-card .story-copy :is(p,small) {
  color:#59636d !important;
}
body.amg-site-refinement :is(.status-card,.playtime-card,.tool-card) {
  background:#14283d !important; color:#e7edf3 !important;
}
body.amg-site-refinement :is(.status-card,.playtime-card,.tool-card) :is(h2,h3,h4,strong,small,li,p,span) {
  color:#e7edf3 !important;
}
body.amg-site-refinement .status-card a { color:#ffadb7 !important; }
body.amg-site-refinement .events-directory .event-month>h2 { color:#fff !important; }
body.amg-site-refinement .contact-card { background:#fff !important; }
body.amg-site-refinement .contact-card :is(h2,h3,label) { color:#202c38 !important; }
body.amg-site-refinement .status-page>.page-hero { margin-bottom:24px; padding-block:40px; }
body.amg-site-refinement .status-page>.status-grid { margin-top:0; }
body.amg-site-refinement .header-cta { border-radius:8px !important; white-space:nowrap !important; width:auto !important; height:auto !important; }
/* Keep lettering baked into the hero photograph inside the visible frame. */
body.home.amg-v4 .amg-top-story .amg-top-image img {
  object-fit:contain !important; transform:none !important;
}
/* Grid items must contain their image and copy rather than paint over neighbours. */
body.home.amg-v4 .ed-side { display:grid; gap:28px; align-content:start; }
body.home.amg-v4 .ed-side-card {
  display:grid; grid-template-rows:auto auto; min-height:0; height:auto;
}
body.home.amg-v4 .ed-side-card>img { width:100%; height:auto; aspect-ratio:16/9; object-fit:cover; }
body.home.amg-v4 .ed-side-card>div {
  position:relative; inset:auto; margin:0; padding:20px; background:#14283d;
}
body.home.amg-v4 .ed-side-card::after { content:none; }
@media(max-width:390px) {
  body.amg-site-refinement .nav-list>li>a { white-space:normal !important; }
  body.amg-site-refinement .header-cta { white-space:nowrap !important; }
}
/* Keep the complete logo, including its tagline, inside the header. */
body.home.amg-v4 .ed-header-main {
 height:auto; min-height:88px; padding-block:12px; align-items:center;
}
body.home.amg-v4 .ed-header .ed-logo {
 display:flex; align-items:center; align-self:center; min-width:0;
 padding:0; margin:0; line-height:0;
}
body.home.amg-v4 .ed-header .ed-logo img {
 display:block; width:205px; max-width:100%; height:56px;
 object-fit:contain; object-position:left center; margin:0; transform:none;
}
@media(max-width:980px) {
 body.home.amg-v4 .ed-header-main { min-height:80px; padding-block:12px; }
 body.home.amg-v4 .ed-header .ed-logo img { width:180px; height:52px; }
}

/* Keyboard and touch accessible More navigation. */
body.home.amg-v4 .ed-more{position:relative}
body.home.amg-v4 .ed-more summary{cursor:pointer;white-space:nowrap;padding:8px}
body.home.amg-v4 .ed-more-menu{position:absolute;right:0;top:100%;width:240px;padding:12px;background:#14283d;border:1px solid #526173;border-radius:12px;z-index:60;display:grid;gap:8px}
body.home.amg-v4 .ed-more-menu a{display:block;padding:8px;color:white;white-space:nowrap}
body.home.amg-v4 .amg-top-copy{max-width:100%;padding:clamp(16px,2vw,28px);box-sizing:border-box}
body.home.amg-v4 .amg-top-copy .ed-label{max-width:100%;white-space:normal;overflow-wrap:anywhere}
@media(max-width:980px){body.home.amg-v4 .ed-header{position:relative}body.home.amg-v4 .ed-nav{display:flex;flex-wrap:wrap;grid-column:1/-1;grid-row:2;justify-content:flex-start;gap:8px 16px;padding-block:10px}body.home.amg-v4 .ed-nav>a{white-space:nowrap}body.home.amg-v4 .ed-more-menu{left:0;right:auto}}
