/*
 * Homepage globe hero + proof section — port of the light Memory Layer
 * concept (Gem Web/memory-layer-campaign/memory-layer-light-concept.html).
 * Markup: template-parts/home/{globe-hero,proof}.php, swapped in for the
 * DB blocks by opal_home_globe_render_block(). JS: js/home-globe.js.
 * Front page only. Class prefix hg- (not opal-, see the opal-block padding trap).
 */
body.home {
  --hg-paper: #f8f8f4;
  --hg-paper-bright: #fdfdfa;
  --hg-ink: #172b32;
  --hg-line: rgba(25, 55, 62, 0.17);
  --hg-display: "VC Garamond Condensed", Georgia, serif;
  --hg-sans: "Apercu", "Helvetica Neue", Arial, sans-serif;
}

/* Masthead sits on the same paper as the hero top edge. */
body.home #masthead.site-header {
  background: var(--hg-paper-bright);
}

body.home .hg-hero,
body.home .hg-proof {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  box-sizing: border-box;
  font-family: var(--hg-sans);
  color: var(--hg-ink);
  text-align: left;
}

body.home .hg-hero *,
body.home .hg-proof * {
  box-sizing: border-box;
}

/* ---------- Hero ---------- */
body.home .hg-hero {
  --globe-w: min(1250px, 116vw);
  min-height: 960px;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 1px solid rgba(26, 58, 65, 0.16);
  background:
    radial-gradient(45% 36% at 51% 68%, rgba(144, 187, 187, 0.12), transparent 80%),
    radial-gradient(36% 36% at 83% 83%, rgba(219, 158, 123, 0.1), transparent 78%),
    linear-gradient(180deg, #fdfdfa, #f8f8f4 55%, #f2f4f0);
}

body.home .hg-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(55, 86, 91, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55, 86, 91, 0.035) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%, #000);
  mask-image: linear-gradient(to bottom, transparent, #000 45%, #000);
}

body.home .hg-hero-copy {
  position: relative;
  z-index: 3;
  width: min(1280px, calc(100% - clamp(40px, 8vw, 128px)));
  margin: 0 auto;
  padding-top: clamp(72px, 9vh, 104px);
  text-align: center;
}

body.home .hg-hero h1 {
  margin: 0 auto;
  padding: 0;
  max-width: 1320px;
  font-family: var(--hg-display);
  font-size: clamp(4.5rem, 6.35vw, 7rem);
  font-weight: 100;
  font-style: normal;
  letter-spacing: -0.012em;
  line-height: 0.9;
  color: var(--hg-ink);
  text-transform: none;
}

/* Each line is a block; .hg-nw phrases never split, so a long line breaks
   only between phrases ("Your Visual Home" / "for Marketing") when narrow. */
body.home .hg-hero h1 > span {
  display: block;
  color: var(--hg-ink);
}

body.home .hg-hero h1 .hg-nw {
  white-space: nowrap;
}

body.home .hg-hero h1 i {
  font-style: italic;
  font-weight: 300;
  /* Italic Garamond overhangs its box; give it room so nothing clips. */
  padding-right: 0.06em;
}

body.home .hg-hero h1 b {
  font-weight: 500;
}

/* No upright Light cut in the concept: thicken Thin to sit beside Light Italic. */
body.home .hg-hero h1 > span:has(i, b) {
  -webkit-text-stroke: 0.012em currentColor;
}

body.home .hg-hero h1 i,
body.home .hg-hero h1 b {
  -webkit-text-stroke: 0;
}

body.home .hg-hero-lede {
  max-width: 690px;
  margin: 29px auto 0;
  padding: 0;
  color: #51666c;
  font-family: var(--hg-sans);
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  line-height: 1.68;
}

body.home .hg-hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 27px;
  margin-top: 32px;
}

body.home .hg-button,
body.home .hg-button:link,
body.home .hg-button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 52px;
  padding: 0 23px;
  color: #fff;
  background: #2a70ea;
  border: 1px solid #2a70ea;
  border-radius: 999px;
  font-family: var(--hg-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease;
}

body.home .hg-button:hover,
body.home .hg-button:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  background: #1f5cc8;
  border-color: #1f5cc8;
}

body.home .hg-text-link,
body.home .hg-text-link:link,
body.home .hg-text-link:visited {
  color: #2d4c54;
  font-family: var(--hg-sans);
  font-size: 0.82rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(45, 76, 84, 0.34);
  padding-bottom: 3px;
}

body.home .hg-text-link:hover,
body.home .hg-text-link:focus-visible {
  color: #a06042;
  border-color: currentColor;
}

body.home .hg-sphere {
  position: absolute;
  z-index: 1;
  top: 470px;
  left: 50%;
  width: var(--globe-w);
  aspect-ratio: 1;
  transform: translate3d(-50%, var(--parallax, 0px), 0);
  will-change: transform;
  pointer-events: none;
}

body.home .hg-sphere::before {
  content: "";
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background: radial-gradient(circle at 47% 37%, rgba(221, 238, 233, 0.55), rgba(219, 232, 232, 0.32) 34%, rgba(244, 221, 202, 0.19) 67%, transparent 73%);
  filter: blur(22px);
  pointer-events: none;
}

body.home .hg-sphere canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

body.home .hg-node {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  color: #243e45;
  background: rgba(253, 253, 250, 0.93);
  border: 1px solid rgba(63, 103, 111, 0.25);
  border-radius: 3px;
  box-shadow: 0 8px 30px rgba(31, 67, 76, 0.1);
  font-family: var(--hg-sans);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -102%) translateY(8px) scale(0.96);
  transition: opacity 0.42s ease, transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

body.home .hg-node::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  background: #73999c;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(115, 153, 156, 0.16);
}

body.home .hg-node::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  height: 20px;
  width: 1px;
  background: rgba(74, 109, 117, 0.38);
}

body.home .hg-node.is-visible {
  opacity: 1;
  transform: translate(-50%, -102%) translateY(0) scale(1);
}

body.home .hg-node:nth-of-type(even)::before {
  background: #d28c66;
  box-shadow: 0 0 0 3px rgba(210, 140, 102, 0.14);
}

/* ---------- Proof: logos + video ---------- */
body.home .hg-proof {
  z-index: 5;
  padding: clamp(64px, 6.5vw, 104px) 0 clamp(100px, 11vw, 160px);
  background: var(--hg-paper-bright);
  box-shadow: 0 -30px 70px rgba(31, 67, 76, 0.06), 0 30px 70px rgba(31, 67, 76, 0.06);
}

body.home .hg-shell {
  width: min(1280px, calc(100% - clamp(40px, 8vw, 128px)));
  margin: 0 auto;
}

body.home .hg-callout {
  display: grid;
  gap: 34px;
  place-items: center;
}

body.home .hg-kicker {
  display: flex;
  gap: 13px;
  align-items: center;
  margin: 0;
  padding: 0;
  color: #6c8487;
  font-family: var(--hg-sans);
  font-size: 0.65rem;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body.home .hg-kicker::before,
body.home .hg-kicker::after {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}

body.home .hg-logo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 18px 34px;
  width: min(920px, 100%);
  margin: 0 auto;
}

body.home .hg-logo-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 78px;
  padding: 18px 12px 26px;
  text-decoration: none;
  outline: none;
}

body.home .hg-logo-cell img {
  width: auto;
  max-width: 112px;
  max-height: 38px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

body.home .hg-case-link {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  color: #a06042;
  font-family: var(--hg-sans);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body.home a.hg-logo-cell:hover img,
body.home a.hg-logo-cell:focus-visible img {
  opacity: 0.72;
  transform: translateY(-8px);
}

body.home a.hg-logo-cell:hover .hg-case-link,
body.home a.hg-logo-cell:focus-visible .hg-case-link {
  opacity: 1;
  transform: translateY(0);
}

body.home .hg-video {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(40px, 6vw, 90px);
  align-items: center;
  margin-top: clamp(56px, 6vw, 88px);
  padding-top: clamp(56px, 6vw, 88px);
  border-top: 1px solid var(--hg-line);
}

body.home .hg-video-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  border: 1px solid rgba(63, 103, 111, 0.18);
  box-shadow: 0 24px 60px rgba(31, 67, 76, 0.12);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

body.home .hg-video-media:hover {
  transform: translateY(-8px);
  box-shadow: 0 32px 70px rgba(31, 67, 76, 0.18);
}

body.home .hg-video-media .opal-wistia-facade {
  width: 100%;
  height: 100%;
}

body.home .hg-video-copy h2 {
  margin: 0 0 22px;
  padding: 0;
  max-width: 14ch;
  font-family: var(--hg-display);
  font-size: clamp(2.8rem, 4vw, 4.4rem);
  font-weight: 100;
  -webkit-text-stroke: 0.012em currentColor;
  letter-spacing: -0.015em;
  line-height: 0.95;
  color: var(--hg-ink);
  text-transform: none;
}

body.home .hg-video-copy h2 em {
  display: block;
  color: #6b8587;
  font-weight: 300;
  font-style: italic;
  white-space: nowrap;
  -webkit-text-stroke: 0;
  padding-right: 0.06em;
}

body.home .hg-video-copy p {
  max-width: 46ch;
  margin: 0 0 32px;
  padding: 0;
  color: #5d7176;
  font-family: var(--hg-sans);
  font-size: 1.03rem;
  line-height: 1.7;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  body.home .hg-hero {
    --globe-w: min(1160px, 135vw);
    min-height: 900px;
  }
  body.home .hg-hero h1 {
    font-size: clamp(4.3rem, 7.4vw, 6rem);
  }
  body.home .hg-sphere {
    top: 440px;
  }
}

@media (max-width: 700px) {
  body.home .hg-hero {
    --globe-w: 195vw;
    min-height: 960px;
  }
  body.home .hg-hero-copy,
  body.home .hg-shell {
    width: calc(100% - 38px);
  }
  body.home .hg-hero-copy {
    padding-top: 56px;
  }
  /* V5 lines are short enough to hold one line each; size by width. */
  body.home .hg-hero h1 {
    font-size: clamp(2.6rem, 14vw, 5.8rem);
    line-height: 0.89;
  }
  body.home .hg-hero-lede {
    max-width: 380px;
    margin-top: 28px;
    font-size: 0.98rem;
    line-height: 1.57;
  }
  body.home .hg-hero-actions {
    flex-direction: column;
    gap: 18px;
    margin-top: 30px;
  }
  body.home .hg-sphere {
    top: 500px;
  }
  body.home .hg-node {
    padding: 8px 10px;
    font-size: 0.5rem;
  }
  body.home .hg-proof {
    padding: 80px 0 90px;
  }
  body.home .hg-logo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  body.home .hg-video {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  body.home .hg-video-copy h2 {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.home .hg-node,
  body.home .hg-button,
  body.home .hg-video-media {
    transition: none;
  }
}
