/* =====================================================================
   Zero to Zen — home hero: "Living Vastu Architecture"
   Markup: server/views/hero.js · behaviour: public/js/hero.js
   An architectural drawing, a Vastu diagram and an editorial page in one:
   warm paper, hairline geometry, champagne gold used sparingly, terracotta
   for a few points of emphasis. Motion is slow and quiet; nothing moves for
   "reduce motion"; low-power devices get fades only.
   ===================================================================== */

.hx {
  --hx-ivory: #F7F4EE;
  --hx-ink: #22201E;
  --hx-terra: #963F34;
  --hx-terra-deep: #7B3129;
  --hx-gold: #C7AD7A;
  --hx-gold-text: #7A6240; /* bronze-gold dark enough for small text on ivory (5.2:1; AA needs 4.5:1) */
  --hx-sand: #EFE7DA;
  --hx-soft: #5A544D;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--hx-ink);
  background-color: var(--hx-ivory);
  background-image: var(--grain);
}
/* An architect's grid on handmade paper — strongest behind the drawing, fading out behind the text. */
.hx::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(34, 32, 30, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(34, 32, 30, .05) 1px, transparent 1px),
    linear-gradient(rgba(34, 32, 30, .028) 1px, transparent 1px), linear-gradient(90deg, rgba(34, 32, 30, .028) 1px, transparent 1px);
  background-size: 160px 160px, 160px 160px, 32px 32px, 32px 32px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(90deg, transparent 8%, rgba(0, 0, 0, .35) 38%, #000 62%);
  mask-image: linear-gradient(90deg, transparent 8%, rgba(0, 0, 0, .35) 38%, #000 62%);
}

/* The header and floating buttons take on the hero's paper and palette. */
.page-home .site-header, .page-home .site-header.is-scrolled { background: rgba(247, 244, 238, .94); border-bottom-color: rgba(34, 32, 30, .08); }
.page-home .wa-float { background: #22201E; box-shadow: 0 0 0 1px rgba(199, 173, 122, .55), 0 16px 30px -16px rgba(34, 32, 30, .6); }
.page-home .wa-float:hover { background: #963F34; }
.page-home .zza-launcher { background: #963F34; border-color: rgba(199, 173, 122, .6); }
.page-home .zza-launcher:hover { background: #7B3129; }

/* ---------------------------------------------------------------- layout */
.hx__inner {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: clamp(20px, 2.5vw, 48px);
  min-height: clamp(560px, calc(100svh - 89px - 92px), 860px);
  padding-block: clamp(24px, 3vw, 48px) 8px;
}
.hx__copy { position: relative; z-index: 3; display: flex; flex-direction: column; gap: 28px; max-width: 560px; }
.hx__kicker { color: var(--hx-terra); }
.hx__kicker::before { background: var(--hx-gold); }
.hx__title { font-size: clamp(44px, 4.1vw + 14px, 86px); line-height: .98; font-weight: 500; letter-spacing: -.02em; color: var(--hx-ink); }
.hx__title .line { display: block; clip-path: inset(-50% -20% -.16em -20%); }
.hx__title .line > span { display: inline-block; }
.hx__title .line--accent { font-style: italic; font-weight: 400; letter-spacing: -.012em; color: var(--hx-terra); }
.hx__tagline { display: flex; align-items: center; gap: 14px; margin: 2px 0 0; font-family: var(--serif); font-size: clamp(20px, .45vw + 16px, 24px); line-height: 1.25; color: #3D3935; }
.hx__rule { width: 40px; height: 1px; background: var(--hx-gold); flex-shrink: 0; }
.hx__lead { max-width: 31em; font-size: clamp(16px, .25vw + 15px, 18px); line-height: 1.75; color: #4B4641; }
.hx__ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 30px; padding-top: 4px; }
.hx .btn--primary, .hx .btn--primary:hover { background: var(--hx-terra); --fill: var(--hx-terra-deep); }

.hx__visual { position: relative; z-index: 1; display: flex; justify-content: center; align-items: center; padding-bottom: 50px; }
/* Sized to the screen height so the drawing, captions and the pillar strip all fit the first view. */
.hx-stage { position: relative; width: clamp(430px, min(100%, calc(100svh - 292px)), 790px); max-width: 100%; aspect-ratio: 1; container: hx-stage / inline-size; }
.hx-layer { position: absolute; inset: 0; }
.hx-in { position: absolute; inset: 0; }
.hx-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hx.is-parallax .hx-layer { will-change: transform; }

/* ---------------------------------------------------------------- drawing styles */
.hx-gold { fill: none; stroke: var(--hx-gold); stroke-width: 1.8; }
.hx-goldfill { fill: var(--hx-gold); stroke: none; }
.hx-ink { fill: none; stroke: var(--hx-ink); stroke-width: 1.2; stroke-linecap: round; }
.hx-dots { stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 0 12.35; }
.hx-axisline { stroke-dasharray: 2 7; }
.hx-centre { fill: none; stroke: rgba(150, 63, 52, .28); stroke-width: 1.2; }

/* The courtyard is a memory, not a picture: low contrast, and it dissolves at every edge. */
.hx-layer--env { opacity: .75; }
.hx-env {
  -webkit-mask-image: radial-gradient(ellipse 60% 46% at 56% 72%, #000 28%, rgba(0, 0, 0, .5) 58%, transparent 82%);
  mask-image: radial-gradient(ellipse 60% 46% at 56% 72%, #000 28%, rgba(0, 0, 0, .5) 58%, transparent 82%);
}
.hx-env-wall { fill: #ECE3D5; opacity: .6; }
.hx-env-open { fill: #F9F6F0; opacity: .85; }
.hx-env-line { stroke: #DCD1C1; stroke-width: 1.2; opacity: .6; }
.hx-env-ripple { stroke: #DCD2C2; stroke-width: 1.6; stroke-linecap: round; fill: none; opacity: .6; }

.hx-layer--plan { opacity: .4; }
.hx-dim { font: 600 13px var(--sans); letter-spacing: .06em; fill: var(--hx-ink); }

.hx-compass-disc { fill: var(--hx-ivory); opacity: .9; }
.hx-dir { font: 600 17px var(--sans); letter-spacing: .12em; fill: #5E5750; }
.hx-dir--n { font: 600 30px var(--serif); letter-spacing: 0; fill: var(--hx-terra); }
.hx-north { fill: var(--hx-terra); }
.hx-needle { transform-origin: 52% 14%; transition: transform 1.4s var(--ease-out); }
.hx-needle-n { fill: var(--hx-terra); }
.hx-needle-s { fill: var(--hx-ink); opacity: .55; }
.hx-needle-pin { fill: var(--hx-ivory); stroke: var(--hx-ink); stroke-width: 1.4; }

.hx-arch-fill { fill: var(--hx-sand); opacity: .62; }
.hx-arch-line { fill: none; stroke: var(--hx-gold); stroke-width: 1.6; }
.hx-arch-line--inner { stroke: var(--hx-terra); stroke-width: 1.1; opacity: .3; }
.hx-frame-line { fill: none; stroke: var(--hx-ink); stroke-width: 1.4; opacity: .42; }
.hx-frame-line--thin { stroke-width: 1; opacity: .26; }
.hx-ground { fill: none; stroke: var(--hx-ink); stroke-width: 1.3; opacity: .38; }
.hx-ground--dim { stroke-width: 1; opacity: .22; }

.hx-axis-line { fill: none; stroke: var(--hx-gold); stroke-width: 1.8; stroke-linecap: round; }
.hx-axis-line--faint { stroke-width: 1.1; stroke-dasharray: 2 8; opacity: .6; }
.hx-node { fill: var(--hx-ivory); stroke: var(--hx-gold); stroke-width: 1.5; }
.hx-node-dot, .hx-node-centre { fill: var(--hx-terra); }
.hx-point { fill: #B99A63; }
.hx-point--soft { fill: var(--hx-gold); }

.hx-person { position: absolute; margin: 0; }
.hx-person img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; }
.hx-person--karan { left: 7%; top: 30%; width: 50%; height: 60%; }
.hx-person--raxa { left: 52%; top: 20%; width: 46.7%; height: 70%; }

/* Architecture × Vastu × Occult sciences, under the ground line */
.hx-captions { position: absolute; left: 0; right: 0; top: 93.6%; }
.hx-cap { position: absolute; top: 0; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; font-size: 12.5px; line-height: 1.4; color: var(--hx-soft); }
.hx-cap strong { font-size: 14.5px; font-weight: 600; color: var(--hx-ink); }
.hx-cap__k { font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--hx-gold-text); }
.hx-cap--karan { left: 14.6%; width: 35.4%; }
.hx-cap--raxa { left: 55.2%; width: 43.6%; }
.hx-cap--centre { display: block; padding-top: 1px; left: 52%; transform: translateX(-50%); font-size: 11px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--hx-terra); white-space: nowrap; }
.hx-cap--centre span { color: var(--hx-gold-text); font-weight: 400; }
/* The "× Vastu ×" caption only fits between the two names when the drawing is wide. */
@container hx-stage (max-width: 540px) {
  .hx-cap--centre { display: none; }
}

/* ---------------------------------------------------------------- service pillars */
.hx-pillars { position: relative; z-index: 3; border-top: 1px solid rgba(34, 32, 30, .14); }
.hx-pillars ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hx-pillar + .hx-pillar { border-left: 1px solid rgba(34, 32, 30, .1); }
.hx-pillar a {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 16px; row-gap: 3px; align-items: center;
  min-height: 44px; padding: 22px 20px 26px; color: var(--hx-ink); transition: transform .6s var(--ease-out);
}
.hx-pillar:first-child a { padding-left: 0; }
.hx-pillar a::after { content: ''; position: absolute; left: 20px; right: 20px; bottom: -1px; height: 1px; background: var(--hx-gold); transform: scaleX(0); transform-origin: left center; transition: transform .8s var(--ease-out); }
.hx-pillar:first-child a::after { left: 0; }
.hx-pillar__ic { grid-row: 1 / 3; width: 40px; height: 40px; fill: none; stroke: var(--hx-ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; transition: stroke .45s ease, transform .9s var(--ease-out); }
.hx-pillar__ic .pi-accent, .hx-pillar__ic .pi-accent-fill { fill: var(--hx-terra); stroke: none; }
.hx-pillar__t { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; line-height: 1.3; }
.hx-pillar__s { font-size: 14px; line-height: 1.45; color: var(--hx-soft); }
.hx-pillar a:hover { color: var(--hx-ink); transform: translateY(-2px); }
.hx-pillar a:hover::after { transform: scaleX(1); }
.hx-pillar a:hover .hx-pillar__ic { stroke: var(--hx-terra); transform: rotate(-8deg); }

/* ---------------------------------------------------------------- load sequence (CSS only, once) */
@keyframes hxBloom { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes hxTurnIn { from { opacity: 0; transform: rotate(-28deg); } to { opacity: 1; transform: none; } }
.hx-up { animation: zRise .95s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 1ms); }
.hx__title .line > span { animation: zLine 1.15s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 1ms); }
.hx-layer--env .hx-svg { animation: zFadeIn 2.2s ease .1s both; }
.hx-layer--plan .hx-svg { animation: zFadeIn 1.4s ease .3s both; }
.hx-layer--plan .hx-draw { animation: zDraw 2.6s var(--ease-in-out) .35s both; }
.hx-in--mandala { transform-origin: 52% 47%; animation: hxBloom 1.7s var(--ease-out) .15s both; }
.hx-geo-static .hx-draw { animation: zDraw 2.2s var(--ease-in-out) .3s both; }
.hx-in--compass { transform-origin: 52% 14%; animation: hxTurnIn 1.7s var(--ease-out) .55s both; }
.hx-compass .hx-draw { animation: zDraw 1.6s var(--ease-in-out) .6s both; }
.hx-frames .hx-arch-fill { animation: zFadeIn 1.4s ease .3s both; }
.hx-frames .hx-draw { animation: zDraw 1.9s var(--ease-in-out) .4s both; }
.hx-person { animation: zMaskUp 1.35s var(--ease-mask) both; }
.hx-person img { animation: zSettle 1.9s var(--ease-out) both; }
.hx-person--raxa, .hx-person--raxa img { animation-delay: .45s; }
.hx-person--karan, .hx-person--karan img { animation-delay: .7s; }
.hx-axis .hx-draw-late { animation: zDraw 1.9s var(--ease-in-out) 1.15s both; }
.hx-axis circle { animation: zFadeIn .9s ease 1.7s both; }
.hx-layer--accents .hx-svg { animation: zFadeIn 1.4s ease 1.5s both; }
.hx-cap { animation: zRise .9s var(--ease-out) both; }
.hx-cap--karan { animation-delay: 1.25s; }
.hx-cap--centre { animation: zFadeIn .9s ease 1.4s both; }
.hx-cap--raxa { animation-delay: 1.15s; }
.hx-pillar { animation: zRise .9s var(--ease-out) both; animation-delay: calc(1050ms + var(--i, 0) * 110ms); }

/* ---------------------------------------------------------------- the living part: slow, quiet, continuous */
@keyframes hxSpin { to { transform: rotate(360deg); } }
@keyframes hxSway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
@media (prefers-reduced-motion: no-preference) {
  .hx-ring { transform-origin: 52% 47%; will-change: transform; }
  .hx-ring--a { animation: hxSpin 80s linear infinite; }
  .hx-ring--b { animation: hxSpin 140s linear infinite reverse; }
  .hx-needle-sway { transform-box: view-box; transform-origin: 520px 140px; animation: hxSway 9s ease-in-out infinite alternate; }
  .hx.is-off .hx-ring, .hx.is-off .hx-needle-sway { animation-play-state: paused; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-flow { display: none; }
}
/* Data-saver / low-power: keep the composition, drop the continuous motion. */
.motion-lite .hx-ring, .motion-lite .hx-needle-sway { animation: none; }
.motion-lite .hx-flow { display: none; }
.motion-lite .hx-draw, .motion-lite .hx-draw-late { animation-name: zFadeIn; }
.motion-lite .hx-person, .motion-lite .hx-person img { animation-name: zFadeIn; }

/* ---------------------------------------------------------------- responsive */
/* Shorter laptop screens: tighter vertical rhythm so the pillars stay in the first view. */
@media (min-width: 900px) and (max-height: 860px) {
  .hx__inner { padding-block: 14px 4px; }
  .hx__copy { gap: 20px; }
  .hx__lead { font-size: 16px; line-height: 1.65; }
  .hx__ctas { padding-top: 0; }
  .hx__visual { padding-bottom: 44px; }
  .hx-pillar a { padding-block: 15px 17px; }
}
@media (max-width: 1279px) {
  .hx__inner { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .hx-pillar a { padding-inline: 16px; column-gap: 12px; }
  .hx-pillar a::after { left: 16px; right: 16px; }
}

/* Tablets: fewer layers. */
@media (max-width: 1179px) {
  .hx-layer--env, .hx-layer--accents { display: none; }
  .hx-layer--plan { opacity: .28; }
  .hx-pillars ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-pillar:nth-child(3) { border-left: 0; }
  .hx-pillar:nth-child(3) a { padding-left: 0; }
  .hx-pillar:nth-child(-n + 2) { border-bottom: 1px solid rgba(34, 32, 30, .1); }
  .hx-pillar:nth-child(3) a::after { left: 0; }
  /* Two-up cells wrap differently, so pin each icon to its label rather than centring it. */
  .hx-pillar a { align-items: start; }
  .hx-pillar__ic { margin-top: -3px; }
}

/* Phones and portrait tablets: headline first, then the portraits with a simplified mandala, then the pillars. */
@media (max-width: 899px) {
  .hx::before { -webkit-mask-image: linear-gradient(180deg, transparent 30%, #000 70%); mask-image: linear-gradient(180deg, transparent 30%, #000 70%); }
  /* On a phone the drawing leads: Raxa and Karan first, then the words. */
  .hx__inner { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 10px; padding-block: 12px 0; }
  .hx__visual { order: -1; padding-bottom: 52px; }  /* room for the names under the ground line */
  .hx__copy { gap: 22px; max-width: none; padding-bottom: 44px; }
  .hx__title { font-size: clamp(40px, 8vw + 10px, 60px); }
  .hx__tagline { font-size: 19px; }
  .hx__ctas { flex-direction: column; align-items: stretch; gap: 6px; }
  .hx__ctas .tlink { justify-content: center; }
  .hx-stage { width: min(100%, 540px); }
  .hx-layer--plan { display: none; }
  .hx-dir { font-size: 30px; }
  .hx-dir--n { font-size: 46px; }
  .hx-gold { stroke-width: 2.2; }
  .hx-dots { stroke-width: 4.4; stroke-dasharray: 0 16; }
  .hx-axis-line { stroke-width: 2.6; }
  .hx-cap { font-size: 11.5px; }
  .hx-cap strong { font-size: 13px; }
  .hx-cap__k { font-size: 10px; letter-spacing: .16em; }
  .hx-pillar a { grid-template-columns: 32px minmax(0, 1fr); padding: 18px 12px 20px; column-gap: 10px; }
  .hx-pillar__ic { width: 32px; height: 32px; }
  .hx-pillar__t { font-size: 11px; letter-spacing: .16em; }
  .hx-pillar__s { font-size: 13px; }
  .hx-pillar a::after { left: 12px; right: 12px; }
}
@media (max-width: 420px) {
  .hx-cap span:not(.hx-cap__k) { display: none; }
}
