# Nightlife photo field hero

> An events app hero where night-out photos fly out from the headline into a floating field, drift at different depths and reveal the venue on hover.

- Category: Social
- Version: 1.0
- Source: https://ownlyplans.com/bhaskar/nightlife-photo-field-hero/

## Overview

A single-file hero for a nightlife and events product, written in plain HTML, CSS and JavaScript with no libraries. Twenty-six night-out photos fly outward from the headline into a hand-placed field, nearest first. Each card sits at its own depth: far ones are small, soft and dim, near ones are large and sharp. They drift on slow loops and move with the pointer by depth, and hovering a near card lifts it and shows the venue and time. In the centre are a live "plans tonight" pill, a two-line headline with a serif accent, a search bar whose suggestion types itself out ("/" focuses it), and quick filter chips. The city button cycles cities and counts. There are separate layouts for desktop, tablet and phone, a phone menu sheet and a reduced-motion mode. The demo brand is Nightlist with free Unsplash photos; swap your own into PHOTOS and move cards in LAYOUTS.

## Tech stack

- CSS
- HTML
- JavaScript

## Build steps

### 1. Set the dark stage, top bar and centre copy

Build the night background, the top bar with a pill nav and city button, and the centred pill, headline, search bar and filter chips.

Prompt:

```text
Create a single-file HTML hero for a nightlife app called "Nightlist", plain HTML, CSS and JavaScript only. Full-screen near-black page (#0b0a10) with three soft colour glows (warm coral in the middle, violet bottom left, blue top right), a dark vignette and a light SVG grain. Top bar: on the left a logo (a coral-to-pink crescent moon with a small white spark) and the wordmark in Bricolage Grotesque 700; in the middle a glass pill nav with Tonight (current), Cities, Venues and For hosts; on the right a glass city button with a pin icon and "Mumbai" plus a white "Get the app" pill. In the centre: a small glass pill with a pulsing green dot reading "214 plans tonight in Mumbai" and an arrow; a two-line headline "Find the night / you'll talk about tomorrow." in Bricolage Grotesque 600 with "night" in Instrument Serif italic filled with a coral-to-pink gradient; a 600px glass search bar with a search icon, a "/" key hint and a coral-to-pink "Find plans →" button; and a row of filter chips (Tonight, Live music, Rooftops, Supper clubs, Comedy, Techno) where one is selected at a time.
```

**Done when:** The page shows the top bar and the centred pill, headline, search bar and chips on a dark glowing background.

### 2. Lay out the photo field by depth

Place photo cards from a layout table, and use each card's depth to set its size, blur, brightness and stacking.

Prompt:

```text
Keep a PHOTOS list of [Unsplash id, orientation L/P/S, caption such as "Sax & Smoke · Fri 9 PM"] and a LAYOUTS object with three hand-placed tables: desktop (26 cards), tablet or any portrait window (18) and phone (10). Each entry is [photo index, x %, y %, depth 0 to 1, rotation]. Keep the middle clear for the copy, and put only small far cards near it. Pick the layout from the window size (phone under 768px; tablet under 1100px or when taller than wide). Base card width follows the window (desktop min(11.8% of width, 21% of height) clamped to 110 to 200px; tablet 17% of width; phone 27%). Multiply it by 0.55 + 0.6 × depth; landscape cards are 0.7 as tall as wide, portrait cards 0.78 as wide and 1.32 times taller, square cards nearly square. Give each card 14px corners and a deep shadow, set z-index from depth, and use a static filter: blur((0.5 - depth) × 7px) for far cards, lower brightness and saturation the further back they are, and opacity 0.4 to 1. Load photos from images.unsplash.com at 520px wide. Recalculate on resize.
```

**Done when:** Photo cards fill the edges of the screen around the copy, with small blurry cards at the back and big sharp ones at the front.

### 3. Fly-in, drift, parallax and hover

Animate everything from one requestAnimationFrame loop: cards fly out from the centre, drift slowly, follow the pointer by depth and lift on hover.

Prompt:

```text
Start the clock when the photos have loaded (or after 5 s). Sort the cards nearest first and give each a delay of 0.12 s + 0.038 s × rank. Over 1.35 s with an ease-out-quart curve, move each card from the screen centre to its slot while scaling from 0.3 to 1, turning to its rotation and fading in. After that, add a slow drift: sine and cosine offsets of 5 to 14px with periods that differ per card, and a rotation wobble of about 1.4 degrees. Ease the pointer position and shift each card by depth (up to 54px across and 36px down) so near cards travel furthest. Near cards (depth 0.55 and up) take the pointer: on hover, ease a value to 1 that lifts the card 6px, scales it 7%, straightens it a little, brings it to the front at full opacity and fades in a glass caption pill under it with the venue and time. Make the centre copy ignore the pointer except for its pill, search and chips, so cards under it can still be hovered.
```

**Done when:** The photos burst out from the headline, settle and keep drifting, follow the mouse with depth, and a near card shows its venue when hovered.

### 4. Headline intro, live search and the phone version

Reveal the copy, make the search suggestion type itself out, wire the chips and city button, and fold the nav into a sheet on phones.

Prompt:

```text
Copy intro: the top bar fades down; the pill fades and lifts in at 0.25 s; each headline word slides up from behind its line mask (translateY 110% to 0, 0.07 s apart, while the full sentence stays as the h1 aria-label); the search bar at 1.05 s and the chips at 1.3 s fade in with a slight blur. Search: keep a real labelled input and an aria-hidden "Try …" overlay that types each of six suggestions at 50ms per letter, holds 1.7 s, deletes and moves on, with a blinking coral caret; hide it while the user types; "/" focuses the input; submit announces the search in a polite status. Chips use aria-pressed with one selected. The city button cycles six cities and updates the city and count in the pill. Pulse the live dot from a CSS variable set in the loop. Under 900px hide the pill nav; under 768px hide the city and app buttons, show a Menu button that opens a full-screen blurred sheet (aria-expanded, Escape or a press outside closes it), shrink the search button to an arrow and show four chips. With prefers-reduced-motion, show everything in place with no fly-in, drift, parallax or typing.
```

**Done when:** The headline reveals word by word, the search suggestion types and deletes on a loop, the city button changes the count, and on a phone the menu sheet opens and closes.

## Assets

### nightlist-photo-field-hero.html — The finished file. Open it in a browser. Swap photos and captions in PHOTOS, move cards in LAYOUTS, and edit cities and search suggestions at the top of the script.

```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="#0b0a10" />
<title>Nightlist · Find the night you'll talk about tomorrow</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Instrument+Serif:ital@1&family=Inter+Tight:wght@400;500;600&display=swap" rel="stylesheet" />
<style>
:root{
  --bg:#0b0a10;--ink:#f6f1ec;--muted:#a59fae;--line:rgba(255,240,230,.12);
  --warm1:#ffb07a;--warm2:#ff5f8f;--green:#4be29a;
  --p:0;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);font-family:"Inter Tight",system-ui,-apple-system,"Segoe UI",sans-serif;-webkit-font-smoothing:antialiased}
body{overflow:hidden}
a{color:inherit}
button{font:inherit;color:inherit}

.nl-hero{position:relative;height:100vh;height:100svh;min-height:620px;overflow:hidden;isolation:isolate}
.nl-bg{position:absolute;inset:0;z-index:-2;background:
  radial-gradient(42% 38% at 50% 48%,rgba(255,112,92,.13),transparent 70%),
  radial-gradient(40% 40% at 10% 92%,rgba(126,84,255,.14),transparent 70%),
  radial-gradient(36% 34% at 92% 8%,rgba(56,176,255,.08),transparent 70%),
  var(--bg)}
.nl-vig{position:absolute;inset:0;z-index:4;pointer-events:none;background:radial-gradient(120% 90% at 50% 50%,transparent 55%,rgba(5,4,8,.75))}
.nl-grain{position:absolute;inset:0;z-index:4;pointer-events:none;opacity:.08;mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")}

/* ---------- photo field ---------- */
.nl-field{position:absolute;inset:0;z-index:1}
.nl-card{position:absolute;left:0;top:0;margin:0;border-radius:14px;overflow:visible;opacity:0;will-change:transform,opacity;pointer-events:none}
.nl-card .ph{position:absolute;inset:0;border-radius:inherit;overflow:hidden;background:#1a1720;box-shadow:0 18px 40px -16px rgba(0,0,0,.85),0 0 0 1px rgba(255,255,255,.06)}
.nl-card img{width:100%;height:100%;object-fit:cover;display:block}
.nl-card[data-near]{pointer-events:auto;cursor:pointer}
.nl-card figcaption{position:absolute;left:8px;bottom:-14px;transform:translateY(100%);white-space:nowrap;padding:6px 10px;border-radius:999px;background:rgba(18,15,24,.82);border:1px solid var(--line);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);font-size:12px;font-weight:500;letter-spacing:-.005em;opacity:0;pointer-events:none}
.nl-card figcaption i{font-style:normal;color:var(--warm1)}

/* ---------- top bar ---------- */
.nl-top{position:absolute;top:0;left:0;right:0;z-index:6;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;padding:20px clamp(18px,3vw,40px)}
.nl-logo{justify-self:start;display:inline-flex;align-items:center;gap:9px;text-decoration:none;font-family:"Bricolage Grotesque","Inter Tight",sans-serif;font-weight:700;font-size:19px;letter-spacing:-.03em}
.nl-logo svg{width:26px;height:26px}
.nl-nav{display:flex;gap:2px;padding:4px;border-radius:999px;background:rgba(20,17,26,.55);border:1px solid var(--line);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.nl-nav a{padding:7px 14px;border-radius:999px;text-decoration:none;font-size:14px;color:var(--muted);transition:color .2s,background .2s}
.nl-nav a:hover{color:var(--ink)}
.nl-nav a[aria-current="page"]{color:var(--ink);background:rgba(255,255,255,.08)}
.nl-right{justify-self:end;display:flex;align-items:center;gap:8px}
.nl-city{display:inline-flex;align-items:center;gap:7px;height:38px;padding:0 14px 0 12px;border-radius:999px;border:1px solid var(--line);background:rgba(20,17,26,.55);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);cursor:pointer;font-size:14px}
.nl-city svg{width:14px;height:14px;color:var(--warm1)}
.nl-city:hover{border-color:rgba(255,200,170,.35)}
.nl-app{display:inline-flex;align-items:center;height:38px;padding:0 16px;border-radius:999px;background:var(--ink);color:#120f16;text-decoration:none;font-size:14px;font-weight:600;transition:transform .2s}
.nl-app:hover{transform:translateY(-1px)}
.nl-menu{display:none;height:38px;padding:0 15px;border-radius:999px;border:1px solid var(--line);background:rgba(20,17,26,.6);cursor:pointer;font-size:14px;align-items:center;gap:8px}
.nl-menu i{display:grid;gap:3px}.nl-menu i b{display:block;width:14px;height:1.5px;background:currentColor;border-radius:2px}
:is(.nl-nav a,.nl-city,.nl-app,.nl-menu,.nl-pill,.nl-go,.nl-chip,.nl-sheet a,.nl-sheet button):focus-visible{outline:2px solid var(--warm1);outline-offset:3px}

/* ---------- centre copy ---------- */
.nl-copy{position:absolute;left:50%;top:50%;z-index:5;width:min(1000px,94vw);transform:translate(-50%,-50%);display:flex;flex-direction:column;align-items:center;text-align:center;pointer-events:none}
.nl-copy>*{pointer-events:auto}
.nl-copy>.nl-h1{pointer-events:none}
.nl-pill{display:inline-flex;align-items:center;gap:9px;padding:6px 8px 6px 12px;border-radius:999px;background:rgba(20,17,26,.7);border:1px solid var(--line);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);text-decoration:none;font-size:13px;color:#ddd5df}
.nl-pill b{font-weight:600;color:var(--ink);font-variant-numeric:tabular-nums}
.nl-pill .arr{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:rgba(255,255,255,.08)}
.nl-pill .arr svg{width:10px;height:10px}
.nl-dot{position:relative;width:7px;height:7px;border-radius:50%;background:var(--green)}
.nl-dot::after{content:"";position:absolute;inset:0;border-radius:50%;background:var(--green);transform:scale(calc(1 + var(--p) * 2.3));opacity:calc(.7 - var(--p) * .7)}
.nl-h1{margin:22px 0 0;font-family:"Bricolage Grotesque","Inter Tight",sans-serif;font-weight:600;font-size:clamp(40px,6vw,88px);line-height:.98;letter-spacing:-.045em;text-shadow:0 8px 40px rgba(0,0,0,.6)}
.nl-line{display:block;overflow:hidden;padding:.04em .06em .1em;margin:-.04em 0 -.1em}
.nl-line .w{display:inline-block;will-change:transform}
.nl-h1 em{font-family:"Instrument Serif",Georgia,serif;font-style:italic;font-weight:400;font-size:1.12em;letter-spacing:-.01em;padding-right:.05em;
  background:linear-gradient(100deg,var(--warm1),var(--warm2));-webkit-background-clip:text;background-clip:text;color:transparent;text-shadow:none}
.nl-h1 .soft{color:#d7cfd9}

.nl-search{position:relative;margin-top:30px;width:min(600px,100%);display:flex;align-items:center;gap:10px;height:60px;padding:0 7px 0 20px;border-radius:999px;background:rgba(24,20,30,.78);border:1px solid rgba(255,230,215,.16);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);box-shadow:0 20px 60px -20px rgba(0,0,0,.9),0 0 0 6px rgba(255,140,110,.04)}
.nl-search:focus-within{border-color:rgba(255,176,122,.5);box-shadow:0 20px 60px -20px rgba(0,0,0,.9),0 0 0 6px rgba(255,140,110,.1)}
.nl-search>svg{width:18px;height:18px;flex:none;color:var(--muted)}
.nl-field-wrap{position:relative;flex:1;min-width:0;height:100%}
.nl-search input{position:absolute;inset:0;width:100%;border:0;outline:0;background:none;color:var(--ink);font:inherit;font-size:16px}
.nl-ghost{position:absolute;left:0;top:50%;transform:translateY(-50%);white-space:nowrap;overflow:hidden;max-width:100%;font-size:16px;color:var(--muted);pointer-events:none}
.nl-ghost b{font-weight:400;color:#e9e1ea}
.nl-caret{display:inline-block;width:1.5px;height:1.05em;margin-left:1px;vertical-align:-2px;background:var(--warm1);opacity:var(--blink,1)}
.nl-kbd{flex:none;display:grid;place-items:center;width:24px;height:24px;border-radius:6px;border:1px solid var(--line);font-size:12px;color:var(--muted)}
.nl-go{flex:none;display:inline-flex;align-items:center;gap:8px;height:46px;padding:0 20px;border:0;border-radius:999px;cursor:pointer;font-weight:600;font-size:15px;color:#1a0d12;
  background:linear-gradient(100deg,var(--warm1),var(--warm2));box-shadow:0 10px 30px -10px rgba(255,95,143,.8),inset 0 1px 0 rgba(255,255,255,.45);transition:transform .2s,box-shadow .2s}
.nl-go:hover{transform:translateY(-1px);box-shadow:0 14px 36px -10px rgba(255,95,143,1),inset 0 1px 0 rgba(255,255,255,.5)}
.nl-go svg{width:15px;height:15px}
.nl-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:16px}
.nl-chip{height:32px;padding:0 13px;border-radius:999px;border:1px solid var(--line);background:rgba(20,17,26,.6);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);font-size:13px;color:#cfc7d2;cursor:pointer;transition:background .2s,color .2s,border-color .2s}
.nl-chip:hover{color:var(--ink);border-color:rgba(255,230,215,.28)}
.nl-chip[aria-pressed="true"]{background:var(--ink);color:#120f16;border-color:var(--ink)}

/* ---------- phone sheet ---------- */
.nl-sheet{position:fixed;inset:0;z-index:7;display:flex;flex-direction:column;justify-content:center;gap:4px;padding:90px 30px 40px;background:rgba(11,10,16,.9);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);opacity:0;visibility:hidden;transition:opacity .25s,visibility .25s}
.nl-sheet[data-open]{opacity:1;visibility:visible}
.nl-sheet a{padding:8px 0;font-family:"Bricolage Grotesque",sans-serif;font-weight:600;font-size:32px;letter-spacing:-.03em;text-decoration:none;color:var(--muted)}
.nl-sheet a[aria-current="page"]{color:var(--ink)}
.nl-sheet .nl-city,.nl-sheet .nl-app{margin-top:18px;align-self:flex-start}
.nl-top[data-open]{z-index:8}
.nl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

@media (max-width:900px){.nl-nav{display:none}.nl-top{grid-template-columns:1fr auto}}
@media (min-width:768px) and (max-width:1099px){.nl-h1{font-size:clamp(48px,8.4vw,84px)}}
@media (max-width:767px){
  .nl-right .nl-city,.nl-right .nl-app{display:none}
  .nl-menu{display:inline-flex}
  .nl-h1{font-size:clamp(36px,10.5vw,52px)}
  .nl-search{height:54px;padding-left:16px}
  .nl-kbd{display:none}
  .nl-go{height:42px;padding:0 15px}
  .nl-go span{display:none}
  .nl-chips .nl-chip:nth-child(n+5){display:none}
}
</style>
</head>
<body>
<section class="nl-hero" aria-labelledby="nl-title">
  <div class="nl-bg" aria-hidden="true"></div>
  <div class="nl-field" aria-hidden="true"></div>
  <div class="nl-vig" aria-hidden="true"></div>
  <div class="nl-grain" aria-hidden="true"></div>

  <header class="nl-top" data-in="0">
    <a class="nl-logo" href="#" aria-label="Nightlist home">
      <svg viewBox="0 0 32 32" aria-hidden="true">
        <defs><linearGradient id="nl-g" x1="4" y1="4" x2="28" y2="28"><stop stop-color="#ffb07a"/><stop offset="1" stop-color="#ff5f8f"/></linearGradient></defs>
        <path d="M20.5 4.5A12 12 0 1 0 27.5 21 9.5 9.5 0 0 1 20.5 4.5Z" fill="url(#nl-g)"/>
        <path d="M24 7l1 2.6L27.6 10.6 25 11.6 24 14.2 23 11.6 20.4 10.6 23 9.6z" fill="#fff"/>
      </svg>
      Nightlist
    </a>
    <nav class="nl-nav" aria-label="Main">
      <a href="#" aria-current="page">Tonight</a>
      <a href="#">Cities</a>
      <a href="#">Venues</a>
      <a href="#">For hosts</a>
    </nav>
    <div class="nl-right">
      <button class="nl-city" type="button" aria-label="Change city, current city Mumbai">
        <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M8 14.5s5-4.3 5-8.2A5 5 0 0 0 3 6.3c0 3.9 5 8.2 5 8.2Z"/><circle cx="8" cy="6.3" r="1.8"/></svg>
        <span data-city>Mumbai</span>
      </button>
      <a class="nl-app" href="#">Get the app</a>
      <button class="nl-menu" type="button" aria-expanded="false" aria-controls="nl-sheet"><i aria-hidden="true"><b></b><b></b></i>Menu</button>
    </div>
  </header>

  <div class="nl-sheet" id="nl-sheet" role="dialog" aria-modal="true" aria-label="Menu">
    <a href="#" aria-current="page">Tonight</a>
    <a href="#">Cities</a>
    <a href="#">Venues</a>
    <a href="#">For hosts</a>
    <a class="nl-app" href="#">Get the app</a>
  </div>

  <div class="nl-copy">
    <a class="nl-pill" href="#" data-in="1">
      <span class="nl-dot" aria-hidden="true"></span>
      <span><b data-count>214</b> plans tonight in <b data-city>Mumbai</b></span>
      <span class="arr" aria-hidden="true"><svg viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M3.5 2l3 3-3 3"/></svg></span>
    </a>
    <h1 class="nl-h1" id="nl-title" aria-label="Find the night you'll talk about tomorrow.">
      <span class="nl-line" aria-hidden="true"><span class="w">Find</span> <span class="w">the</span> <em class="w">night</em></span>
      <span class="nl-line soft" aria-hidden="true"><span class="w">you'll</span> <span class="w">talk</span> <span class="w">about</span> <span class="w">tomorrow.</span></span>
    </h1>
    <form class="nl-search" role="search" data-in="2">
      <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><circle cx="9" cy="9" r="6"/><path d="m14 14 3.5 3.5"/></svg>
      <div class="nl-field-wrap">
        <label class="nl-sr" for="nl-q">Search events, venues and artists</label>
        <input id="nl-q" type="search" autocomplete="off" />
        <span class="nl-ghost" aria-hidden="true">Try <b data-ghost></b><span class="nl-caret"></span></span>
      </div>
      <span class="nl-kbd" aria-hidden="true">/</span>
      <button class="nl-go" type="submit"><span>Find plans</span><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 8h10M9 4l4 4-4 4"/></svg></button>
    </form>
    <div class="nl-chips" role="group" aria-label="Quick filters" data-in="3">
      <button class="nl-chip" type="button" aria-pressed="true">Tonight</button>
      <button class="nl-chip" type="button" aria-pressed="false">Live music</button>
      <button class="nl-chip" type="button" aria-pressed="false">Rooftops</button>
      <button class="nl-chip" type="button" aria-pressed="false">Supper clubs</button>
      <button class="nl-chip" type="button" aria-pressed="false">Comedy</button>
      <button class="nl-chip" type="button" aria-pressed="false">Techno</button>
    </div>
  </div>
  <span class="nl-sr" role="status" aria-live="polite"></span>
</section>

<script>
(() => {
/* ---------- content: swap in your own ---------- */
const IMG = id => `https://images.unsplash.com/photo-${id}?w=520&q=75&auto=format&fit=crop`;
// [unsplash id, orientation L/P/S, caption]
const PHOTOS = [
  ['1516450360452-9312f5e86fc7','L','Neon Tide · <i>Fri 10 PM</i>'],
  ['1514525253161-7a46d19cd819','L','Confetti Hall · <i>Sat 9 PM</i>'],
  ['1545128485-c400e7702796','L','Red Room · <i>Thu 11 PM</i>'],
  ['1713450605268-5f8ba67f5b55','S','Blur Social · <i>Fri 11 PM</i>'],
  ['1583244532610-2a234e7c3eca','L','Neon Loop · <i>Sat 10 PM</i>'],
  ['1593958812614-2db6a598c71c','L','Violet Haze · <i>Fri 9 PM</i>'],
  ['1578736641330-3155e606cd40','L','Laser Garden · <i>Sat 12 AM</i>'],
  ['1485872299829-c673f5194813','S','Late Pour · <i>Thu 9 PM</i>'],
  ['1631901589746-219fcffbdd29','L','Chandelier Club · <i>Sat 10 PM</i>'],
  ['1597290282695-edc43d0e7129','L','Amber Bar · <i>Daily 7 PM</i>'],
  ['1569924995012-c4c706bfcd51','P','The Counter · <i>Wed 8 PM</i>'],
  ['1597075687490-8f673c6c17f6','P','Martini Hour · <i>Tue 7 PM</i>'],
  ['1566417713940-fe7c737a9ef2','L','Mixology Night · <i>Thu 8 PM</i>'],
  ['1578911489158-334e5cd2a051','P','Quiet Bar · <i>Sun 9 PM</i>'],
  ['1605270012917-bf157c5a9541','L','Tasting Flight · <i>Fri 7 PM</i>'],
  ['1528605248644-14dd04022da1','L','Long Table · <i>Sun 1 PM</i>'],
  ['1699730148588-42aabafe9c72','P','Candle Supper · <i>Sat 8 PM</i>'],
  ['1527529482837-4698179dc6ce','L','Hall Feast · <i>Sat 7 PM</i>'],
  ['1415201364774-f6f0bb35f28f','L','Sax & Smoke · <i>Fri 9 PM</i>'],
  ['1511192336575-5a79af67a629','L','Blue Note Set · <i>Thu 10 PM</i>'],
  ['1531971772042-d189c2021395','L','Disco Ball Live · <i>Sat 9 PM</i>'],
  ['1541532713592-79a0317b6b77','P','Cheers Club · <i>Fri 10 PM</i>'],
  ['1517457373958-b7bdd4587205','L','Patio Party · <i>Sat 6 PM</i>'],
  ['1609992185485-d7391e0e3094','P','Ridge Deck · <i>Sat 7 PM</i>'],
  ['1758272133693-d2124dbe00de','L','Sunset Roof · <i>Sun 5 PM</i>'],
  ['1526749464606-83091e34a261','P','Drum Circle Live · <i>Fri 9 PM</i>']
];
// [photo index, x %, y %, depth 0-1 (1 = nearest), rotation deg]
const LAYOUTS = {
  desktop: [
    [0, 8,25,.92,-8],[8, 24,13,.55,6],[2, 39,6,.28,-4],[9, 61,7,.32,5],[6, 76,15,.62,-6],[3, 92,24,.88,7],
    [19, 5,42,.72,4],[13, 19,32,.35,-3],[4, 13,60,.96,-5],[22, 28,52,.3,8],[16, 6,84,.62,6],[1, 22,80,.84,-7],
    [11, 36,93,.42,4],[24, 50,97,.24,-3],[14, 64,92,.48,6],[20, 79,82,.92,-5],[10, 94,86,.55,8],[5, 87,38,.78,-4],
    [12, 73,31,.34,5],[21, 96,61,.66,3],[18, 82,62,1,6],[7, 71,53,.28,-6],[17, 33,28,.2,3],[23, 67,22,.2,-5],[25, 59,84,.2,-4],[15, 44,85,.18,2]
  ],
  tablet: [
    [0, 13,10,.82,-6],[8, 37,6,.4,4],[2, 63,8,.5,-3],[3, 88,11,.86,6],[13, 7,27,.5,5],[5, 93,29,.62,-5],
    [17, 26,21,.28,3],[12, 75,21,.28,-4],[4, 8,74,.72,-4],[22, 31,80,.45,6],[14, 56,86,.6,-5],[20, 84,77,.9,5],
    [1, 17,93,.86,7],[10, 72,96,.5,-6],[21, 95,92,.42,4],[24, 44,96,.28,3],[19, 5,52,.58,4],[18, 95,56,.66,-5]
  ],
  phone: [
    [0, 15,16,.82,-7],[3, 52,11,.45,4],[5, 86,17,.86,6],[17, 32,26,.32,-3],[12, 72,26,.36,5],
    [4, 9,83,.75,5],[14, 41,89,.55,-5],[20, 80,85,.92,-4],[1, 22,97,.45,6],[10, 62,98,.35,3]
  ]
};
const CITIES = [['Mumbai',214],['Bengaluru',187],['Delhi',241],['Goa',96],['Hyderabad',132],['Visakhapatnam',58]];
const SUGGESTIONS = ['rooftop jazz in Bandra','a supper club this Saturday','techno past midnight','comedy night near me','live sax and cocktails','a quiet bar with vinyl'];

/* ---------- setup ---------- */
const root = document.documentElement;
const hero = document.querySelector('.nl-hero');
const field = document.querySelector('.nl-field');
const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
const easeOut = x => 1 - Math.pow(1 - x, 4);
const easeCubic = x => 1 - Math.pow(1 - x, 3);

const cards = PHOTOS.map((p, i) => {
  const fig = document.createElement('figure');
  fig.className = 'nl-card';
  fig.innerHTML = `<div class="ph"><img alt="" decoding="async" src="${IMG(p[0])}"></div><figcaption>${p[2]}</figcaption>`;
  field.appendChild(fig);
  const c = { el: fig, cap: fig.querySelector('figcaption'), o: p[1], h: 0, hover: false, seed: i * 1.731 + 0.4, slot: null };
  fig.addEventListener('pointerenter', () => { c.hover = true; });
  fig.addEventListener('pointerleave', () => { c.hover = false; });
  return c;
});

const view = { w: 0, h: 0, mode: '' };
function layout() {
  const w = hero.clientWidth, h = hero.clientHeight;
  view.w = w; view.h = h;
  view.mode = w < 768 ? 'phone' : (w < 1100 || h > w) ? 'tablet' : 'desktop';
  const base = view.mode === 'phone' ? w * 0.27 : view.mode === 'tablet' ? clamp(w * 0.17, 110, 190) : clamp(Math.min(w * 0.118, h * 0.21), 110, 200);
  cards.forEach(c => { c.slot = null; });
  LAYOUTS[view.mode].forEach((s, rank) => {
    const c = cards[s[0]];
    const depth = s[3];
    const scale = 0.55 + 0.6 * depth;
    const cw = (c.o === 'P' ? base * 0.78 : c.o === 'S' ? base * 0.86 : base) * scale;
    const ch = c.o === 'P' ? cw * 1.32 : c.o === 'S' ? cw * 1.0 : cw * 0.7;
    c.slot = { x: s[1] / 100 * w, y: s[2] / 100 * h, depth, rot: s[4], cw, ch };
    c.el.style.width = cw + 'px';
    c.el.style.height = ch + 'px';
    c.el.style.zIndex = String(Math.round(depth * 100));
    const blur = Math.max(0, 0.5 - depth) * 7;
    c.el.querySelector('.ph').style.filter = `blur(${blur.toFixed(2)}px) brightness(${(0.5 + 0.5 * depth).toFixed(2)}) saturate(${(0.7 + 0.3 * depth).toFixed(2)})`;
    c.baseOpacity = 0.4 + 0.6 * Math.min(1, depth * 1.5);
    c.el.toggleAttribute('data-near', depth >= 0.55);
  });
  // fly-in order: nearest first
  const shown = cards.filter(c => c.slot).sort((a, b) => b.slot.depth - a.slot.depth);
  shown.forEach((c, i) => { c.delay = 0.12 + i * 0.038; });
  cards.forEach(c => { if (!c.slot) c.el.style.opacity = 0; });
}
new ResizeObserver(layout).observe(hero);
layout();

/* ---------- intro for the copy ---------- */
const intro = [];
document.querySelectorAll('[data-in]').forEach(el => {
  const i = +el.dataset.in;
  intro.push({ el, delay: [0.1, 0.25, 1.05, 1.3][i], dur: 0.8, y: i === 0 ? -10 : 14, blur: i === 0 ? 0 : 6 });
});
const words = [...document.querySelectorAll('.nl-line .w')];
words.forEach((el, i) => intro.push({ el, delay: 0.35 + i * 0.07, dur: 0.95, y: 110, unit: '%', word: true }));
intro.forEach(it => { if (!it.word) it.el.style.opacity = 0; else it.el.style.transform = 'translateY(110%)'; });
function runIntro(t) {
  for (const it of intro) {
    if (it.done) continue;
    const p = reduce ? 1 : clamp((t - it.delay) / it.dur, 0, 1);
    const e = it.word ? easeOut(p) : easeCubic(p);
    if (!it.word) {
      it.el.style.opacity = e;
      it.el.style.filter = p < 1 && it.blur ? `blur(${(1 - e) * it.blur}px)` : '';
    }
    it.el.style.transform = p < 1 ? `translateY(${(1 - e) * it.y}${it.unit || 'px'})` : '';
    if (p >= 1) it.done = true;
  }
}

/* ---------- search: cycling suggestion, "/" to focus ---------- */
const form = document.querySelector('.nl-search');
const input = document.getElementById('nl-q');
const ghost = document.querySelector('.nl-ghost');
const ghostText = document.querySelector('[data-ghost]');
const status = document.querySelector('.nl-sr[role="status"]');
const plan = [];
let total = 0;
SUGGESTIONS.forEach(s => { const type = s.length * 0.05, hold = 1.7, del = s.length * 0.022; plan.push({ s, start: total, type, hold, del }); total += type + hold + del + 0.35; });
function ghostAt(t) {
  if (reduce) return SUGGESTIONS[0];
  const k = ((t % total) + total) % total;
  const seg = plan.find(p => k >= p.start && k < p.start + p.type + p.hold + p.del + 0.35) || plan[0];
  const x = k - seg.start;
  if (x < seg.type) return seg.s.slice(0, Math.ceil(x / 0.05));
  if (x < seg.type + seg.hold) return seg.s;
  if (x < seg.type + seg.hold + seg.del) return seg.s.slice(0, Math.max(0, seg.s.length - Math.ceil((x - seg.type - seg.hold) / 0.022)));
  return '';
}
const syncGhost = () => { ghost.style.visibility = input.value ? 'hidden' : 'visible'; };
input.addEventListener('input', syncGhost);
document.addEventListener('keydown', e => {
  if (e.key === '/' && document.activeElement !== input && !/INPUT|TEXTAREA/.test(document.activeElement.tagName)) { e.preventDefault(); input.focus(); }
});
form.addEventListener('submit', e => {
  e.preventDefault();
  const q = input.value.trim() || ghostText.textContent;
  status.textContent = `Searching for ${q} in ${CITIES[cityIx][0]}`;
});

/* ---------- chips + city ---------- */
const chips = [...document.querySelectorAll('.nl-chip')];
chips.forEach(ch => ch.addEventListener('click', () => chips.forEach(o => o.setAttribute('aria-pressed', String(o === ch)))));
let cityIx = 0;
document.querySelectorAll('.nl-city').forEach(btn => btn.addEventListener('click', () => {
  cityIx = (cityIx + 1) % CITIES.length;
  const [name, n] = CITIES[cityIx];
  document.querySelectorAll('[data-city]').forEach(el => { el.textContent = name; });
  document.querySelectorAll('[data-count]').forEach(el => { el.textContent = n; });
  document.querySelectorAll('.nl-city').forEach(b => b.setAttribute('aria-label', `Change city, current city ${name}`));
  status.textContent = `${n} plans tonight in ${name}`;
}));

/* ---------- phone menu ---------- */
const top = document.querySelector('.nl-top');
const menuBtn = document.querySelector('.nl-menu');
const sheet = document.getElementById('nl-sheet');
function setMenu(open) {
  menuBtn.setAttribute('aria-expanded', String(open));
  sheet.toggleAttribute('data-open', open);
  top.toggleAttribute('data-open', open);
  if (open) sheet.querySelector('a').focus(); else menuBtn.focus();
}
menuBtn.addEventListener('click', () => setMenu(menuBtn.getAttribute('aria-expanded') !== 'true'));
document.addEventListener('keydown', e => { if (e.key === 'Escape' && sheet.hasAttribute('data-open')) setMenu(false); });
sheet.addEventListener('click', e => { if (e.target === sheet || e.target.closest('a')) setMenu(false); });

/* ---------- pointer parallax ---------- */
const ptr = { x: 0, y: 0, sx: 0, sy: 0 };
window.addEventListener('pointermove', e => { ptr.x = e.clientX / innerWidth - 0.5; ptr.y = e.clientY / innerHeight - 0.5; });

/* ---------- start once photos are in (or after 5 s) ---------- */
let t0 = null, last = 0;
const imgs = [...field.querySelectorAll('img')];
const loaded = Promise.all(imgs.map(im => im.complete ? 1 : new Promise(r => { im.onload = im.onerror = r; })));
Promise.race([loaded, new Promise(r => setTimeout(r, 5000))]).then(() => {
  t0 = performance.now(); last = t0; root.dataset.ready = '1';
});

function frame(now) {
  requestAnimationFrame(frame);
  if (t0 === null) return;
  const dt = Math.min(0.05, (now - last) / 1000); last = now;
  const t = (now - t0) / 1000;

  runIntro(t);
  root.style.setProperty('--p', ((t % 1.8) / 1.8).toFixed(3));
  if (!input.value) {
    ghostText.textContent = ghostAt(t - 1.6 > 0 ? t - 1.6 : 0);
    root.style.setProperty('--blink', (Math.sin(t * 7) > -0.2 ? 1 : 0));
  }

  const f = reduce ? 0 : 1 - Math.exp(-dt * 3.2);
  ptr.sx += (ptr.x - ptr.sx) * f; ptr.sy += (ptr.y - ptr.sy) * f;
  const cx = view.w / 2, cy = view.h / 2;

  for (const c of cards) {
    const s = c.slot;
    if (!s) continue;
    const p = reduce ? 1 : clamp((t - c.delay) / 1.35, 0, 1);
    const e = easeOut(p);
    const amp = reduce ? 0 : 1;
    const dx = amp * Math.sin(t * (0.42 + (c.seed % 0.3)) + c.seed) * (5 + 9 * s.depth);
    const dy = amp * Math.cos(t * (0.36 + (c.seed % 0.25)) + c.seed * 1.7) * (4 + 8 * s.depth);
    const dr = amp * Math.sin(t * 0.3 + c.seed * 2.1) * 1.4;
    const px = -ptr.sx * s.depth * 54, py = -ptr.sy * s.depth * 36;
    c.h += ((c.hover ? 1 : 0) - c.h) * Math.min(1, dt * 10);
    const x = cx + (s.x - cx) * e + (dx + px) * e;
    const y = cy + (s.y - cy) * e + (dy + py) * e - c.h * 6;
    const sc = (0.3 + 0.7 * e) * (1 + c.h * 0.07);
    const rot = s.rot * e + dr * e - s.rot * c.h * 0.5;
    c.el.style.transform = `translate3d(${(x - s.cw / 2).toFixed(1)}px,${(y - s.ch / 2).toFixed(1)}px,0) rotate(${rot.toFixed(2)}deg) scale(${sc.toFixed(3)})`;
    c.el.style.opacity = (c.baseOpacity * Math.min(1, e * 1.8) + c.h * (1 - c.baseOpacity)).toFixed(3);
    if (c.h > 0.002 || c.cap.style.opacity !== '0') { c.cap.style.opacity = c.h.toFixed(3); c.el.style.zIndex = c.h > 0.05 ? '120' : String(Math.round(s.depth * 100)); }
  }
}
requestAnimationFrame(frame);
})();
</script>
</body>
</html>
```


## Build instructions by tool

### Claude Code

Open a terminal in an empty folder, run `claude`, then paste the prompt.

```text
Build the "Nightlife photo field hero" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/nightlife-photo-field-hero/.
Stack: CSS, HTML, JavaScript.
Follow the plan's steps in order: Set the dark stage, top bar and centre copy → Lay out the photo field by depth → Fly-in, drift, parallax and hover → Headline intro, live search and the phone version.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Claude Code.)
```

### Cursor

Open an empty folder in Cursor, start an Agent chat, then paste the prompt.

```text
Build the "Nightlife photo field hero" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/nightlife-photo-field-hero/.
Stack: CSS, HTML, JavaScript.
Follow the plan's steps in order: Set the dark stage, top bar and centre copy → Lay out the photo field by depth → Fly-in, drift, parallax and hover → Headline intro, live search and the phone version.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Cursor.)
```

### Lovable

Start a new Lovable project and paste the prompt as your first message.

```text
Build the "Nightlife photo field hero" app from the OwnlyPlans blueprint at https://ownlyplans.com/bhaskar/nightlife-photo-field-hero/.
Stack: CSS, HTML, JavaScript.
Follow the plan's steps in order: Set the dark stage, top bar and centre copy → Lay out the photo field by depth → Fly-in, drift, parallax and hover → Headline intro, live search and the phone version.
Download the full plan (Markdown) from the link above and keep it in the project root as PLAN.md.
Ask me before adding anything not in the plan. (Prepared for Lovable.)
```

## Definition of done

- Every build step is complete and the app runs locally.
- The main user flow works end to end.
- Share your build on OwnlyPlans with a demo link, build time and tool.
