/* Homepage: the street of centres (street.js), a few words with the photo clip, then the e-invites. */

/* ---------- The street ---------- */
.street {
  --scene-w: min(1116px, 114vw); /* the picture carries its own snow out past each side */
  position: relative; overflow: hidden; padding: 22px 0 0;
  background: radial-gradient(120% 70% at 50% 30%, #3f6fc4 0%, #2a53a4 55%, #1f3f86 100%);
}
.street-title { position: relative; z-index: 1; width: min(338px, 78vw); margin: 0 auto; }
.street-title img { display: block; width: 100%; height: auto; }
/* The dates, so it reads as an event, then what to do: tap a house to go in. */
.street-date {
  position: relative; z-index: 1; width: fit-content; margin: 4px auto 0; padding: 4px 14px; border-radius: 999px;
  background: var(--gold); color: #1f3f86; font: 400 clamp(20px, 4.4vw, 26px)/1.1 var(--display); letter-spacing: .04em;
}
.street-pick {
  position: relative; z-index: 1; max-width: 26em; margin: 10px auto 0; padding: 0 var(--gutter); text-align: center;
  font: 600 clamp(15px, 3.6vw, 19px)/1.35 var(--body); color: #fff; text-wrap: balance;
}

/* The picture, with its snow carrying on to both sides of the screen. The signboards hang above the roofs,
   so the picture starts a sign's height lower. */
.street-view { position: relative; margin-top: 64px; }
.street-view::before { /* the snow either side, level with the picture's own (scripts/make-scene.py prints it) */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--scene-w) * 962 / 1600 * .3 + 1px);
  background: #f2efe6;
}
.street-scene { position: relative; width: var(--scene-w); margin: 0 auto; }
.street-img { position: relative; display: block; width: 100%; height: auto; }

/* The two lamp posts in the picture glow, and sparkle now and then. */
.street-glow {
  position: absolute; width: 13%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(rgba(255, 231, 163, .7), rgba(255, 231, 163, 0) 62%);
  animation: street-glow 2.6s ease-in-out infinite;
}
.street-glow.g1 { left: 18.2%; top: 44.5%; }
.street-glow.g2 { left: 83.3%; top: 44.5%; animation-delay: 1.3s; }
.street-glow::before, .street-glow::after {
  content: ""; position: absolute; width: 14%; aspect-ratio: 1; background: url('../svg/deco/sparkle.svg') center / contain no-repeat;
  animation: street-twinkle 1.9s ease-in-out infinite;
}
.street-glow::before { left: 18%; top: 22%; }
.street-glow::after { right: 16%; bottom: 26%; width: 10%; animation-delay: .9s; }
@keyframes street-glow { 50% { opacity: .55; scale: .9; } }
@keyframes street-twinkle { 0%, 100% { opacity: 0; scale: .4; rotate: 0deg; } 50% { opacity: 1; scale: 1; rotate: 25deg; } }

/* Signboards: one over each house, in the house's own colour. The whole house front is the link. */
.street-houses { list-style: none; margin: 0; padding: 0; }
.street-house { position: absolute; left: var(--x); top: var(--y); width: 13%; height: calc(67% - var(--y)); translate: -50% 0; }
.street-house a { position: absolute; inset: 0; display: block; text-decoration: none; color: #fff; }
.street-sign {
  position: absolute; left: 50%; bottom: 100%; translate: -50% -10px; rotate: -2deg;
  display: grid; justify-items: center; padding: 7px 12px 6px; white-space: nowrap;
  background: var(--c); border: 3px solid var(--cream); border-radius: 8px; box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
  transition: translate .2s ease, rotate .2s ease, scale .2s ease;
}
.street-house:nth-child(even) .street-sign { rotate: 2deg; }
.street-sign b { font: 400 clamp(17px, 2.2vw, 22px)/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.street-sign small { margin-top: 2px; font-size: 11px; font-weight: 700; opacity: .9; }
:lang(zh-Hans) .street-sign b { font: 700 clamp(16px, 2vw, 20px)/1.1 'FZHanYH', var(--body); letter-spacing: .1em; }
/* "Step inside" grows out of the sign while you point at (or tab to) the house. */
.street-go {
  display: block; max-height: 0; overflow: hidden; opacity: 0; margin-top: 0;
  font-weight: 800; font-size: 13px; color: var(--gold); transition: max-height .2s ease, opacity .2s ease, margin .2s ease;
}
.street-house a:hover .street-sign, .street-house a:focus-visible .street-sign { translate: -50% -18px; rotate: 0deg; scale: 1.08; }
.street-house a:hover .street-go, .street-house a:focus-visible .street-go { max-height: 2em; opacity: 1; margin-top: 4px; }
.street-house a:focus-visible { outline: none; }
.street-house a:focus-visible .street-sign { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Falling snow, in front of the sky and behind the signs. */
.street-snow { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.street-snow::before, .street-snow::after {
  content: ""; position: absolute; left: 0; right: 0; top: -400px; bottom: 0;
  background: url('../img/house/snow.svg') 0 0 / 400px 400px;
  animation: street-snow 14s linear infinite;
}
.street-snow::after { top: -260px; background-size: 260px 260px; opacity: .6; animation-duration: 20s; animation-name: street-snow-far; }
@keyframes street-snow { to { transform: translateY(400px); } }
@keyframes street-snow-far { to { transform: translateY(260px); } }

@media (max-width: 759px) {
  /* Phones: the whole street on one screen. The picture is scaled so its five houses (from Central at 26% to North East
     at 79%) fill the width, and the trees past either end are trimmed; nothing scrolls sideways. */
  .street { --scene-w: min(143vw, 1017px); }
  .street-view { overflow: hidden; margin-top: 0; padding-top: 34px; }
  .street-scene { margin-left: calc(50% - var(--scene-w) * .52); }
  /* Signs shrink to just the area's name; the whole house front is still the link. */
  .street-sign { padding: 4px 6px 3px; border-width: 2px; border-radius: 6px; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); white-space: normal; text-align: center; width: max-content; max-width: 21vw; translate: -50% -4px; }
  .street-sign b { font-size: clamp(12px, 3.4vw, 15px); line-height: 1.05; }
  :lang(zh-Hans) .street-sign b { font-size: clamp(12px, 3.4vw, 15px); letter-spacing: .04em; }
  .street-sign small, .street-go { display: none; }
  .street-house a:hover .street-sign, .street-house a:focus-visible .street-sign { translate: -50% -8px; scale: 1.06; }
  /* Central's house is the tallest, so its sign sits on its roof rather than in the sky above the picture. */
  .street-house[data-centre="axis"] .street-sign { translate: -50% 16px; }
  .street-house[data-centre="axis"] a:is(:hover, :focus-visible) .street-sign { translate: -50% 12px; }
}

/* ---------- A few words, and the photo clip ---------- */
.welcome {
  display: grid; gap: 28px; align-items: center; padding: 56px var(--gutter) 64px; background: var(--night);
}
@media (min-width: 860px) { .welcome { grid-template-columns: 1.1fr .9fr; gap: 48px; padding: 72px max(40px, calc((100vw - 1100px) / 2)); } }
.welcome-title { margin: 0 0 16px; font: 400 clamp(38px, 7vw, 64px)/.92 var(--display); text-transform: uppercase; color: var(--gold); }
.welcome-copy p { margin: 0 0 12px; font-size: clamp(17px, 2vw, 20px); line-height: 1.45; }
.welcome-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 5px solid var(--gold); border-radius: 16px; background: #000; }
.welcome-media > img, .welcome-media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Going in (street.js): the street zooms in on the door, the signs and words step back, and the house's colour
   fills the screen. */
.street::after {
  content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: var(--enter, var(--night)); opacity: 0; transition: opacity .35s ease .5s;
}
.street.is-entering::after { opacity: 1; }
.street-scene { transition: transform .85s cubic-bezier(.55, 0, .75, .4); }
.street.is-entering .street-scene { transform: scale(6); }
/* Phones trim the street's sides (overflow: hidden); while zooming in, let it fill the whole screen instead. */
.street.is-entering .street-view { overflow: visible; }
.street.is-entering :is(.street-sign, .street-title, .street-date, .street-pick) { opacity: 0; transition: opacity .25s ease; }

@media (prefers-reduced-motion: reduce) {
  .street-snow::before, .street-snow::after, .street-glow, .street-glow::before, .street-glow::after { animation: none; }
  .street-sign, .street-go { transition: none; }
}
