.home-route {
  --route-background: #132f3d;
  --route-hover: #214a60;
  --route-muted: #dce8ed;
  --route-accent: #eed9a4;
  --route-rule: #d8e8ef45;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(1240px, calc(100% - 48px));
  margin-inline: auto;
  background: var(--route-background);
  color: #fff;
}

.home-route[data-theme="forest"] {
  --route-background: #153830;
  --route-hover: #285246;
  --route-muted: #dce9df;
  --route-accent: #e3e7b6;
  --route-rule: #d8eee345;
}

.home-route[data-theme="slate"] {
  --route-background: #1e343f;
  --route-hover: #30505f;
}

.home-route a {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 94px;
  flex-direction: column;
  justify-content: center;
  gap: .34rem;
  padding: .8rem clamp(32px, 4vw, 52px) .8rem clamp(14px, 2vw, 28px);
  color: #fff;
  text-decoration: none;
  line-height: 1.35;
  transition: background-color 160ms ease;
}

.home-route a + a { border-inline-start: 1px solid var(--route-rule); }
.home-route a:hover { background: var(--route-hover); }
.home-route a:focus-visible { outline: 2px solid var(--route-accent); outline-offset: -4px; }
.home-route strong { font-size: clamp(1.03rem, 1.45vw, 1.3rem); font-weight: 720; }
.home-route a > span { color: var(--route-muted); font-size: .82rem; }
.home-route a .home-route-arrow {
  position: absolute;
  inset-inline-end: clamp(10px, 1.5vw, 20px);
  inset-block-start: 50%;
  color: var(--route-accent);
  font-size: 1.15rem;
  transform: translateY(-50%);
  transition: transform 160ms ease;
}
.home-route a:hover .home-route-arrow { transform: translateY(-25%); }

:is(main, main div):has(> .home-route[data-layout="flush"]),
.xinyang-home {
  --route-content-max: 1320px;
  --route-content-gutter: clamp(20px, 5vw, 64px);
  --route-content-inset: max(var(--route-content-gutter), (100% - var(--route-content-max)) / 2);
  --route-content-width: calc(100% - 2 * var(--route-content-inset));
  --route-band: var(--xinyang-deep, #132f3d);
}

:is(main, main div):has(> .home-route[data-layout="flush"][data-theme="forest"]) {
  --route-band: #153830;
}

:is(main, main div):has(> .home-route[data-layout="flush"][data-theme="slate"]) {
  --route-band: #1e343f;
}

:is(main, main div):has(> .home-route[data-layout="flush"]) > section:is(.container, .shell),
:is(main, main div):has(> .home-route[data-layout="flush"]) > section > :is(.container, .shell, .field-wrap, .wb-width),
.xinyang-home > section > .field-wrap {
  width: var(--route-content-width);
  margin-inline: auto;
}

.tc-business-home:has(> .home-route[data-layout="flush"]) > section > .container {
  padding-inline: 0;
}

.home-route[data-layout="flush"] {
  width: 100%;
  padding-inline: var(--route-content-inset);
  border-block-start: 1px solid var(--route-rule);
  background: var(--route-band);
}

.home-route[data-layout="flush"] > a:first-child { padding-inline-start: 0; }

/* Keep the four routes within reach while leaving room for longer hero copy. */
.tc-hero:has(+ .home-route) { --route-header-height: 79px; }
.field-hero:has(+ .home-route) { --route-header-height: var(--field-header-height); }
.xj-hero:has(+ .home-route) { --route-header-height: var(--xj-header-height); }
.trade-hero:has(+ .home-route) { --route-header-height: var(--header-height); }
.compliance-hero:has(+ .home-route) .compliance-hero__layout {
  --route-header-height: var(--home-header-height);
}
:is(.tc-hero, .field-hero, .xj-hero, .trade-hero):has(+ .home-route),
.compliance-hero:has(+ .home-route) .compliance-hero__layout {
  min-height: max(530px, calc(100svh - var(--route-header-height, 74px) - 100px));
}

.home-service-panel[data-home-route-target]:focus-visible {
  outline: 2px solid var(--home-service-gold);
  outline-offset: -3px;
}

.compliance-home .home-service-photo .home-feature__media {
  width: 100%;
}

body:has(.home-route) .home-service-panel { scroll-margin-block-start: 84px; }

@media (max-width: 799px) {
  .home-route { grid-template-columns: repeat(2, minmax(0, 1fr)); width: calc(100% - 32px); }
  .home-route a { min-height: 76px; padding: .55rem 24px .55rem .7rem; gap: .2rem; }
  .home-route strong { font-size: clamp(.96rem, 4vw, 1.05rem); }
  .home-route a > span { font-size: .76rem; }
  .home-route a:nth-child(odd) { border-inline-start: 0; }
  .home-route[data-layout="flush"] > a:nth-child(3) { padding-inline-start: 0; }
  .home-route a:nth-child(n+3) { border-block-start: 1px solid var(--route-rule); }
  .home-route a .home-route-arrow { inset-inline-end: 7px; font-size: 1rem; }
  .tc-hero:has(+ .home-route) { --route-header-height: 65px; }
  :is(.tc-hero, .field-hero, .xj-hero, .trade-hero):has(+ .home-route),
  .compliance-hero:has(+ .home-route) .compliance-hero__layout {
    min-height: max(465px, calc(100svh - var(--route-header-height, 65px) - 154px));
  }
  .compliance-hero:has(+ .home-route) .compliance-hero__photo::after {
    background: linear-gradient(to top, #141c19f5, #141c19d4 33%, #141c1988 64%, #141c1926 90%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-route a, .home-route a .home-route-arrow { transition: none; }
}
