/* ===========================================================================
   The community line: the hero shared by index.php and index-alt.php.
   Markup in community-hero.php, geometry in community-map.php.
   =========================================================================== */

.hw-hero {
  position: relative;
  overflow: hidden;
  background: #08192b;
  color: #fff;
  padding: 0;
}

/* Depth behind the plan, in the site gradient's own colours. */
.hw-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at 12% 88%, rgba(30, 64, 175, 0.42) 0%, transparent 60%),
    radial-gradient(ellipse 55% 60% at 78% 24%, rgba(8, 145, 178, 0.30) 0%, transparent 62%),
    radial-gradient(ellipse 50% 50% at 95% 60%, rgba(5, 150, 105, 0.26) 0%, transparent 60%),
    linear-gradient(135deg, #0f2b46 0%, #0d2740 45%, #08192b 100%);
}

.hw-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  max-width: 1680px;
  margin: 0 auto;
  padding: 5rem 2rem 5.5rem;
}

.hw-map-wrap { min-width: 0; }

/* The plan is cropped, not shrunk.
   preserveAspectRatio="xMaxYMid slice" scales the viewBox to COVER this box
   and clips the overflow, so the shape of the box alone decides how much of
   the community is on screen -- which means one SVG serves every width with
   no JavaScript and no second copy of the markup. At 2/1 the box matches the
   viewBox exactly and nothing is cropped; the taller boxes further down zoom
   in on the end of the route instead of rendering houses ten pixels wide. */
.hw-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1400 / 700;
  overflow: hidden;
}

/* --- the plan --- */

.hw-roads path,
.hw-roads circle {
  fill: none;
  stroke: rgba(226, 240, 255, 0.10);
  stroke-width: 15;
  stroke-linecap: round;
}

.hw-spurs path {
  fill: none;
  stroke: rgba(226, 240, 255, 0.13);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: hw-draw var(--t, 0.45s) ease-out var(--d, 0s) forwards;
}

/* The line. One gradient, one glow, drawn street by street. */
.hw-route {
  filter: drop-shadow(0 0 7px rgba(14, 165, 233, 0.5))
          drop-shadow(0 0 22px rgba(16, 185, 129, 0.22));
}

.hw-route path,
.hw-route circle {
  fill: none;
  stroke: url(#hw-route-grad);
  stroke-width: 3.6;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: hw-draw var(--t, 1s) cubic-bezier(0.37, 0, 0.19, 1) var(--d, 0s) forwards;
}

@keyframes hw-draw { to { stroke-dashoffset: 0; } }

/* --- houses --- */

.hw-house-plan {
  fill: rgba(226, 240, 255, 0.045);
  stroke: rgba(226, 240, 255, 0.22);
  stroke-width: 1.3;
}

.hw-house-roof {
  fill: none;
  stroke: rgba(226, 240, 255, 0.20);
  stroke-width: 1.1;
  stroke-linecap: round;
}

.hw-house-lit { fill: #6ee7b7; opacity: 0; }

.hw-house { animation: hw-wake 0.85s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s) forwards; }

/* A house is dim until the line gets there, then it is on and stays on. */
@keyframes hw-wake {
  0%   { opacity: 0.5; }
  45%  { opacity: 1; }
  100% { opacity: 1; }
}

.hw-house .hw-house-plan {
  animation: hw-wake-plan 0.85s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s) forwards;
}

@keyframes hw-wake-plan {
  to { fill: rgba(52, 211, 153, 0.13); stroke: rgba(167, 243, 208, 0.75); }
}

.hw-house .hw-house-roof { animation: hw-wake-roof 0.85s ease-out var(--d, 0s) forwards; }
@keyframes hw-wake-roof { to { stroke: rgba(167, 243, 208, 0.45); } }

.hw-house .hw-house-lit { animation: hw-wake-dot 1.1s ease-out var(--d, 0s) forwards; }
@keyframes hw-wake-dot {
  0%   { opacity: 0; r: 1; }
  40%  { opacity: 1; }
  100% { opacity: 0.85; }
}

/* --- traffic: the dots that keep running to every house --- */

.hw-traffic {
  opacity: 0;
  animation: hw-fade 1.2s ease-out var(--d, 0s) forwards;
  filter: drop-shadow(0 0 5px rgba(110, 231, 183, 0.75));
}

.hw-dot-street { fill: #a7f3d0; opacity: 0; }
.hw-dot-home   { fill: #ecfdf5; opacity: 0; }

/* The ring a house throws when its dot lands. */
.hw-dot-land {
  fill: none;
  stroke: #6ee7b7;
  stroke-width: 1.4;
  opacity: 0;
}

/* --- the terminus, where the line meets the message --- */

.hw-terminus { opacity: 0; animation: hw-fade 0.8s ease-out var(--d, 0s) forwards; }
.hw-terminus-ring { fill: none; stroke: #34d399; stroke-width: 1.6; opacity: 0.55; }
.hw-terminus-dot  { fill: #a7f3d0; }

.hw-terminus-glow { animation: hw-breathe 3.4s ease-in-out infinite; transform-origin: center; }
@keyframes hw-breathe {
  0%, 100% { opacity: 0.75; transform: scale(0.94); }
  50%      { opacity: 1;    transform: scale(1.06); }
}

@keyframes hw-fade { to { opacity: 1; } }

/* ===== THE MESSAGE ===== */

.hw-message {
  position: relative;
  padding: 2.5rem 2.25rem;
  border-radius: 20px;
  background: rgba(8, 25, 43, 0.55);
  border: 1px solid rgba(167, 243, 208, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

/* The line arrives here: an accent down the leading edge, and a node on it at
   the same height as the terminus in the plan. */
.hw-message::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 1.75rem;
  bottom: 1.75rem;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, #0ea5e9 0%, #06b6d4 45%, #34d399 100%);
}

.hw-message::after {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: #a7f3d0;
  box-shadow: 0 0 0 5px rgba(52, 211, 153, 0.18), 0 0 18px rgba(52, 211, 153, 0.6);
}

.hw-message-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6ee7b7;
  margin-bottom: 1rem;
}

.hw-message h1 {
  font-size: clamp(1.75rem, 2.5vw, 2.6rem);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
}

.hw-message h1 em {
  font-style: normal;
  background: linear-gradient(120deg, #7dd3fc 0%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hw-message p {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(226, 240, 255, 0.78);
  margin-bottom: 1.75rem;
}

.hw-message-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hw-btn-primary {
  background: linear-gradient(120deg, #0891b2 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgba(5, 150, 105, 0.35);
}

.hw-btn-primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(5, 150, 105, 0.45);
}

.hw-btn-ghost {
  background: rgba(226, 240, 255, 0.06);
  border: 1px solid rgba(226, 240, 255, 0.22);
  color: rgba(226, 240, 255, 0.92);
}

.hw-btn-ghost:hover {
  background: rgba(226, 240, 255, 0.12);
  color: #fff;
  transform: translateY(-2px);
}

/* ===========================================================================
   NARROWER SCREENS
   The plan stops being a wide panorama beside the words and becomes a tall
   window below them, zoomed in on the end of the route. Nothing is redrawn --
   only the shape of the box changes, and the slice crop does the rest.
   =========================================================================== */

@media (max-width: 1199.98px) {
  .hw-hero-inner { grid-template-columns: minmax(0, 1fr) 360px; padding: 4rem 1.5rem 4.5rem; }
  .hw-map { aspect-ratio: 1200 / 700; }
}

@media (max-width: 991.98px) {
  .hw-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.25rem;
    padding: 3.25rem 1.25rem 3.5rem;
  }
  /* The message leads; the plan illustrates it. */
  .hw-message-wrap { order: 1; }
  .hw-map-wrap     { order: 2; }

  .hw-message { padding: 2rem 1.5rem; }
  /* The node pointed at the plan's terminus, which is no longer beside it. */
  .hw-message::after { display: none; }

  .hw-map { aspect-ratio: 5 / 4; }
}

@media (max-width: 575.98px) {
  .hw-hero-inner { padding: 2.5rem 1rem 3rem; gap: 1.75rem; }

  /* A phone gets the tightest crop: roughly the last third of the route, at
     houses large enough to read as houses. */
  .hw-map { aspect-ratio: 9 / 10; }

  .hw-message { padding: 1.6rem 1.25rem; border-radius: 16px; }
  .hw-message h1 { font-size: 1.7rem; line-height: 1.18; }
  .hw-message p  { font-size: 0.95rem; margin-bottom: 1.4rem; }
  .hw-message-eyebrow { font-size: 0.66rem; margin-bottom: 0.75rem; }

  /* Thumb-sized, and full width so the two never sit awkwardly side by side. */
  .hw-message-actions { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .hw-btn { width: 100%; padding: 0.9rem 1.25rem; }
}

/* The animation is the idea, but it is not the information. Anyone who asked
   for less motion gets the finished plan, immediately and still. */
@media (prefers-reduced-motion: reduce) {
  .hw-route path, .hw-route circle, .hw-spurs path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .hw-house, .hw-house .hw-house-plan, .hw-house .hw-house-roof,
  .hw-house .hw-house-lit, .hw-terminus, .hw-terminus-glow {
    animation: none;
  }
  .hw-house .hw-house-plan { fill: rgba(52, 211, 153, 0.13); stroke: rgba(167, 243, 208, 0.75); }
  .hw-house .hw-house-roof { stroke: rgba(167, 243, 208, 0.45); }
  .hw-house .hw-house-lit  { opacity: 0.85; }
  .hw-terminus { opacity: 1; }
  .hw-traffic  { display: none; }
}
