Skip to content
ai-native.marketingSubscribe

Nightjar

An overnight train operator whose hero is a hanging split-flap departures board that flips through tonight's trains, with every button flipping its letters the same way.

Travel · 14 Nov 2026

nightjar.html

About this concept

Nightjar is a one-page site for a travel brand that sells a journey rather than a seat. A split-flap departures board flips through tonight's trains and takes your booking choice, berths sit in train-window crops with a blind that lifts on scroll, a coordinates label follows the cursor, and every button flips its label tile by tile. It suits rail, ferry, coach, and tour operators.

Remix it with your agent

Paste this into Claude, ChatGPT, Cursor, or any coding agent together with the HTML file.

Here is a single-file HTML page called Nightjar. Keep the hanging split-flap departures board that flips through sets of departures with a random glyph before each final letter, the booking form that writes the visitor's chosen destination onto the board, the train-window photo crops with a blind that lifts on scroll and a teal tint that clears on hover, the parallax photo layers, the coordinates label that follows the cursor, and the buttons whose label flips tile by tile like a split-flap. Turn it into a site for [your travel business, such as a ferry line, coach tour, or rail operator]: rename it to [name], rewrite the headline and intro for [what you offer and who for], replace the departures and timetable with [your routes, times, and days], replace the three berths with [your fare classes, descriptions, and prices], rewrite the three times in the night section for [your journey], and update the form fields to [your booking options]. Replace the Pexels photos with [your own photography] and keep the credits for any that stay. Keep the night, paper, amber, and teal palette unless I give you brand colours. Respect prefers-reduced-motion. One HTML file only.

The code

Show 407 lines of HTML (24 KB, one file, no build step)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nightjar | Sleeper trains across Europe</title>
<meta name="description" content="Nightjar runs overnight trains between twelve European cities. Board at 21:40, sleep through the border, step out in the centre of the next city.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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=Barlow+Condensed:wght@500;600;700&family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..700&family=Hanken+Grotesk:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
  --night:#0f1424;--night2:#1a2138;--paper:#f2ead8;--amber:#ffb238;--signal:#e4452f;--teal:#2c6e68;
  --serif:'Fraunces',Georgia,serif;--cond:'Barlow Condensed','Arial Narrow',sans-serif;--sans:'Hanken Grotesk',system-ui,sans-serif;
  --pad:clamp(1.1rem,4vw,3.5rem);
}
*{box-sizing:border-box;margin:0}
html{scroll-behavior:smooth;background:var(--night)}
body{font:400 clamp(1rem,.95rem + .25vw,1.15rem)/1.6 var(--sans);color:var(--paper);background:var(--night);overflow-x:hidden}
img{display:block;max-width:100%}
a{color:inherit}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
h1,h2,h3{font-family:var(--serif);font-weight:400;line-height:1.02;letter-spacing:-.02em}
h2{font-size:clamp(2.2rem,1.2rem + 4.6vw,5.2rem);max-width:15ch}
.lede{max-width:46ch;font-size:clamp(1.05rem,1rem + .4vw,1.3rem);opacity:.85;margin-top:1.1rem}
.wrap{padding-inline:var(--pad);max-width:1500px;margin-inline:auto}

/* header */
header{position:absolute;inset:0 0 auto 0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.1rem var(--pad)}
.mark{font:italic 500 1.7rem/1 var(--serif);text-decoration:none;letter-spacing:-.02em}
.mark i{display:inline-block;width:.32em;height:.32em;background:var(--amber);margin-left:.08em}
nav{display:flex;align-items:center;gap:clamp(1rem,2.4vw,2.2rem)}
nav a.t{font:600 1.05rem/1 var(--cond);letter-spacing:.06em;text-transform:uppercase;text-decoration:none;padding:.4rem 0;background:linear-gradient(currentColor,currentColor) 0 100%/0 2px no-repeat;transition:background-size .3s}
nav a.t:hover,nav a.t:focus-visible{background-size:100% 2px}
@media (max-width:760px){nav a.t{display:none}}

/* split-flap buttons: every button on the page shares this */
.btn{display:inline-flex;align-items:stretch;gap:3px;text-decoration:none;border:0;background:none;color:var(--night);cursor:pointer;font:600 1.15rem/1 var(--cond);letter-spacing:.08em;text-transform:uppercase;padding:0;border-radius:0}
.btn .lbl{display:inline-flex;gap:3px;background:var(--paper);padding:.85em 1.1em;white-space:nowrap}
.js .btn .lbl{background:none;padding:0;gap:3px}
.tile{position:relative;display:inline-block;width:.92em;height:1.95em;letter-spacing:0;font-size:1.1em;perspective:260px;transform-style:preserve-3d;transition:transform .42s calc(var(--i)*26ms) cubic-bezier(.55,0,.2,1)}
.tile.sp{width:.42em}
.tile .a,.tile .b{position:absolute;inset:0;display:grid;place-items:center;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.tile .a{background:var(--paper);color:var(--night)}
.tile .b{background:var(--night);color:var(--amber);transform:rotateX(180deg);outline:1px solid var(--amber);outline-offset:-1px}
.tile.sp .a,.tile.sp .b{background:none;outline:0}
.tile:not(.sp) .a::after,.tile:not(.sp) .b::after{content:"";position:absolute;left:0;right:0;top:50%;height:1px;background:rgba(15,20,36,.4)}
.tile:not(.sp) .b::after{background:rgba(255,178,56,.5)}
.btn:hover .tile,.btn:focus-visible .tile{transform:rotateX(-180deg)}
.btn:focus-visible{outline:2px solid var(--amber);outline-offset:4px}
.btn.dark .tile .a{background:var(--amber)}
.btn.dark .tile .b{background:var(--night);color:var(--paper);outline-color:var(--paper)}
.btn.dark .lbl{background:var(--amber)}

/* hero */
.hero{position:relative;min-height:100svh;display:flex;flex-direction:column;justify-content:flex-end;padding:7.5rem var(--pad) clamp(2rem,5vw,4rem);isolation:isolate;overflow:hidden}
.hero .bg{position:absolute;inset:-12% 0;z-index:-2;will-change:transform}
.hero .bg img{width:100%;height:100%;object-fit:cover;filter:grayscale(1) contrast(1.15) brightness(1.2)}
.hero .bg::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(15,20,36,.6),rgba(15,20,36,.1) 38%,rgba(15,20,36,.9));mix-blend-mode:multiply}
.hero .bg::before{content:"";position:absolute;inset:0;z-index:1;background:var(--teal);mix-blend-mode:color;opacity:.55}
.hero-in{display:flex;flex-direction:column;max-width:1500px;width:100%;margin-inline:auto}
.hero h1{order:2;font-size:clamp(3.6rem,2rem + 12.5vw,14rem);font-weight:300;font-variation-settings:'opsz' 144;margin-top:clamp(1.5rem,4vw,3rem)}
.hero h1 em{font-style:italic;color:var(--amber)}
.hero .after{order:3;display:flex;flex-wrap:wrap;align-items:center;gap:1.4rem 2.4rem;margin-top:1.4rem}
.hero .after p{max-width:40ch;opacity:.88}
.board-wrap{order:1;position:relative;max-width:1180px;width:100%;margin-inline:auto 0}
.board-wrap::before,.board-wrap::after{content:"";position:absolute;bottom:100%;width:3px;height:100vh;background:linear-gradient(transparent,rgba(242,234,216,.5));left:12%}
.board-wrap::after{left:auto;right:12%}
.board{background:#0a0e1b;border:2px solid #272f4a;padding:clamp(.6rem,1.6vw,1.4rem);box-shadow:0 30px 60px rgba(0,0,0,.45)}
.row{--cw:clamp(15px,calc((min(100vw,1180px) - 3rem - 2 * clamp(.6rem,1.6vw,1.4rem)) / 18.7),58px);display:flex;gap:2px;margin:3px 0;font:600 calc(var(--cw)*1.1)/1 var(--cond);color:var(--amber);white-space:pre;text-transform:uppercase}
.js .row{white-space:normal}
.cell{position:relative;flex:0 0 var(--cw);height:calc(var(--cw)*1.5);perspective:300px;background:var(--night2)}
.h{position:absolute;left:0;right:0;height:50%;overflow:hidden;background:var(--night2)}
.h b{position:absolute;left:0;right:0;height:200%;display:grid;place-items:center;font-weight:600}
.h.top{top:0}.h.top b{top:0}
.h.bot{bottom:0}.h.bot b{bottom:0}
.h.top{border-bottom:1px solid #05070f}
.ft{transform-origin:50% 100%}
.fb{transform-origin:50% 0;transform:rotateX(90deg)}
.ft,.fb{visibility:hidden;backface-visibility:hidden;-webkit-backface-visibility:hidden}
.go .ft,.go .fb{visibility:visible}
.go .ft{animation:ft .11s ease-in forwards}
.go .fb{animation:fb .11s .11s ease-out forwards}
@keyframes ft{to{transform:rotateX(-90deg)}}
@keyframes fb{to{transform:rotateX(0)}}

/* sections */
section{position:relative;padding:clamp(4.5rem,10vw,9rem) 0}
.paper{background:var(--paper);color:var(--night)}
.paper .lede{opacity:.8}
.windows{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(1rem,3vw,3rem);margin-top:clamp(2.5rem,5vw,4.5rem);align-items:start}
.win:nth-child(2){margin-top:clamp(0rem,5vw,5rem)}
.frame{position:relative;aspect-ratio:3/4;border-radius:clamp(26px,4vw,64px);overflow:hidden;border:clamp(8px,1.2vw,14px) solid var(--night);background:var(--night);isolation:isolate}
.frame img{position:absolute;left:0;top:-12%;width:100%;height:124%;object-fit:cover;will-change:transform}
.frame::after{content:"";position:absolute;inset:0;background:var(--teal);mix-blend-mode:color;opacity:.85;transition:opacity .5s;z-index:1;pointer-events:none}
.win:hover .frame::after{opacity:0}
.blind{position:absolute;left:0;right:0;top:0;height:13%;background:repeating-linear-gradient(180deg,#1d2640 0 6px,#161d33 6px 10px);z-index:2;border-bottom:3px solid var(--amber);transition:height 1.1s cubic-bezier(.6,0,.2,1)}
.js .win:not(.in) .blind{height:101%}
.win h3{font-size:clamp(1.6rem,1.1rem + 1.6vw,2.4rem);margin-top:1.2rem}
.win p{margin-top:.5rem;max-width:34ch;opacity:.85}
.win .fare{font:600 1.15rem/1 var(--cond);letter-spacing:.08em;text-transform:uppercase;margin-top:.9rem;display:block}
@media (max-width:820px){.windows{grid-template-columns:1fr;max-width:460px}.win:nth-child(2){margin-top:0}}

.tt{margin-top:2.6rem;width:100%;border-collapse:collapse;font-size:clamp(1rem,.9rem + .4vw,1.25rem)}
.tt caption{text-align:left;position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.tt th{font:600 1.05rem/1 var(--cond);letter-spacing:.08em;text-transform:uppercase;text-align:left;padding:.9rem 1rem .9rem 0;border-bottom:2px solid var(--night)}
.tt td{padding:1.15rem 1rem 1.15rem 0;border-bottom:1px solid rgba(15,20,36,.25);transition:background .25s,padding .25s}
.tt td:first-child{font:400 clamp(1.3rem,1rem + 1.5vw,2.2rem)/1.1 var(--serif);letter-spacing:-.01em}
.tt td.n{font:600 1.35rem/1 var(--cond);letter-spacing:.04em;white-space:nowrap}
.tt tbody tr:hover td{background:var(--amber);padding-left:.8rem}
@media (max-width:640px){.tt thead{display:none}.tt,.tt tbody,.tt tr,.tt td{display:block}.tt tr{padding:1rem 0;border-bottom:1px solid rgba(15,20,36,.25)}.tt td{border:0;padding:.15rem 0}.tt tbody tr:hover td{padding-left:0;background:none}}

.night{overflow:hidden;isolation:isolate}
.night .bg{position:absolute;inset:-14% 0;z-index:-1;will-change:transform}
.night .bg img{width:100%;height:100%;object-fit:cover;filter:grayscale(1) brightness(1.1) contrast(1.15)}
.night .bg::after{content:"";position:absolute;inset:0;background:var(--night);opacity:.7;mix-blend-mode:multiply}
.night .bg::before{content:"";position:absolute;inset:0;z-index:1;background:var(--signal);mix-blend-mode:color;opacity:.45}
.clock{display:grid;grid-template-columns:repeat(3,1fr);gap:clamp(1.4rem,4vw,4rem);margin-top:clamp(2.5rem,6vw,5rem)}
.clock div{border-top:2px solid var(--amber);padding-top:1.1rem}
.clock b{display:block;font:300 clamp(3.4rem,2rem + 7vw,9rem)/.9 var(--serif);letter-spacing:-.04em;font-variant-numeric:tabular-nums}
.clock span{display:block;margin-top:.8rem;max-width:30ch;opacity:.88}
@media (max-width:760px){.clock{grid-template-columns:1fr}}

.book{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);gap:clamp(2rem,6vw,6rem);align-items:start}
@media (max-width:900px){.book{grid-template-columns:1fr}}
form{display:grid;gap:1.4rem}
.two{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
@media (max-width:520px){.two{grid-template-columns:1fr}}
label,.fl{display:grid;gap:.4rem;font:600 1.05rem/1 var(--cond);letter-spacing:.08em;text-transform:uppercase}
select,input[type=date]{font:400 1.15rem/1.2 var(--sans);padding:.9rem 1rem;border:2px solid var(--night);background:transparent;color:var(--night);border-radius:0;width:100%;min-width:0}
select:focus-visible,input:focus-visible{outline:3px solid var(--amber);outline-offset:2px}
.chips{display:flex;flex-wrap:wrap;gap:.6rem}
.chips label{display:block;position:relative}
.chips input{position:absolute;opacity:0;inset:0;cursor:pointer}
.chips span{display:block;padding:.8rem 1.1rem;border:2px solid var(--night);font:600 1.05rem/1 var(--cond);letter-spacing:.08em}
.chips input:checked + span{background:var(--night);color:var(--amber)}
.chips input:focus-visible + span{outline:3px solid var(--amber);outline-offset:2px}
#msg{min-height:1.6em;font-weight:500}

footer{padding:3rem 0 3.5rem;border-top:1px solid rgba(242,234,216,.2);font-size:.95rem}
footer .wrap{display:grid;gap:1.4rem;grid-template-columns:1fr 1fr}
@media (max-width:700px){footer .wrap{grid-template-columns:1fr}}
footer .big{font:italic 400 clamp(2rem,1.4rem + 2vw,3.2rem)/1 var(--serif)}
footer p{opacity:.8;max-width:56ch}
footer a{text-underline-offset:3px}

/* cursor coordinates */
#coord{position:fixed;left:0;top:0;z-index:50;pointer-events:none;background:var(--amber);color:var(--night);font:700 .85rem/1 var(--cond);letter-spacing:.08em;padding:.3rem .5rem;opacity:0;white-space:nowrap}
#coord::before{content:"";position:absolute;left:-7px;top:-7px;width:7px;height:7px;border-left:2px solid var(--amber);border-top:2px solid var(--amber)}
@media (hover:none),(pointer:coarse){#coord{display:none}}

.js .rv{opacity:0;transform:translateY(26px);transition:opacity .8s,transform .8s cubic-bezier(.2,.7,.2,1)}
.js .rv.in{opacity:1;transform:none}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  .js .rv{opacity:1;transform:none;transition:none}
  .js .win:not(.in) .blind{height:13%}
  .blind,.tile,.frame::after{transition:none}
  .go .ft,.go .fb{animation:none}
  #coord{display:none}
  .hero .bg,.night .bg,.frame img{transform:none!important}
}
</style>
</head>
<body>
<a class="sr" href="#book">Skip to booking</a>
<header>
  <a class="mark" href="#top" aria-label="Nightjar home">Nightjar<i></i></a>
  <nav aria-label="Main">
    <a class="t" href="#cabins">Berths</a>
    <a class="t" href="#timetable">Timetable</a>
    <a class="t" href="#night">The night</a>
    <a class="btn" href="#book" data-flap><span class="lbl">Book</span></a>
  </nav>
</header>

<main id="top">
<div class="hero">
  <div class="bg" data-par="0.18"><img src="https://images.pexels.com/photos/9781539/pexels-photo-9781539.jpeg?auto=compress&cs=tinysrgb&w=2200" alt="" width="2200" height="1467" fetchpriority="high"></div>
  <div class="hero-in">
    <h1>Arrive <em>rested.</em></h1>
    <div class="board-wrap">
      <div class="board" id="board" role="group" aria-label="Tonight's departures" data-clip-ok>
<div class="row">21:40 VIENNA    P4</div>
<div class="row">21:55 ZAGREB    P2</div>
<div class="row">22:10 MUNICH    P7</div>
<div class="row">22:30 HAMBURG   P1</div>
      </div>
    </div>
    <div class="after">
      <a class="btn" href="#book" data-flap><span class="lbl">See tonight</span></a>
      <p>Overnight trains between twelve European cities. Board at 21:40, sleep through the border, step out in the centre.</p>
    </div>
  </div>
</div>

<section id="cabins" class="paper">
  <div class="wrap">
    <h2 class="rv">Pick the window you wake up at</h2>
    <p class="lede rv">Three ways to travel, one rule on every carriage: lights down at midnight, voices down with them.</p>
    <div class="windows">
      <article class="win rv">
        <div class="frame"><img src="https://images.pexels.com/photos/30595797/pexels-photo-30595797.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=1500&w=900" alt="A passenger resting in a train compartment, seen from above" width="900" height="1350" loading="lazy" data-par="0.1"><div class="blind"></div></div>
        <h3>Night seat</h3>
        <p>A reclining seat, a blanket, a locker under your head. For people who sleep anywhere and would rather spend on dinner.</p>
        <span class="fare">From 29 euro</span>
      </article>
      <article class="win rv">
        <div class="frame"><img src="https://images.pexels.com/photos/30595798/pexels-photo-30595798.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=1500&w=900" alt="Passengers resting in a train cabin with bunk beds" width="900" height="1350" loading="lazy" data-par="0.14"><div class="blind"></div></div>
        <h3>Six-berth couchette</h3>
        <p>A made-up bunk with a reading light and a curtain. Shared with strangers who all want the same thing as you.</p>
        <span class="fare">From 59 euro</span>
      </article>
      <article class="win rv">
        <div class="frame"><img src="https://images.pexels.com/photos/8217961/pexels-photo-8217961.jpeg?auto=compress&cs=tinysrgb&fit=crop&h=1500&w=900" alt="The interior of a sleeper train with capsule beds" width="900" height="1350" loading="lazy" data-par="0.08"><div class="blind"></div></div>
        <h3>Private sleeper</h3>
        <p>A door that locks, a basin, and breakfast brought at 07:00. The border crossing happens without you.</p>
        <span class="fare">From 119 euro</span>
      </article>
    </div>
  </div>
</section>

<section id="timetable" class="paper" style="padding-top:0">
  <div class="wrap">
    <h2 class="rv">Leaving tonight and most nights</h2>
    <p class="lede rv">Every departure leaves from a central station and arrives at one. No airport transfers on either end.</p>
    <table class="tt rv">
      <caption>Nightjar timetable</caption>
      <thead><tr><th>Route</th><th>Leaves</th><th>Arrives</th><th>Runs</th></tr></thead>
      <tbody>
        <tr><td>Amsterdam to Vienna</td><td class="n">21:45</td><td class="n">09:05</td><td class="n">Daily</td></tr>
        <tr><td>Hamburg to Zurich</td><td class="n">22:30</td><td class="n">08:10</td><td class="n">Mon, Wed, Fri, Sun</td></tr>
        <tr><td>Barcelona to Milan</td><td class="n">21:50</td><td class="n">08:20</td><td class="n">Tue, Fri, Sun</td></tr>
        <tr><td>Prague to Krakow</td><td class="n">22:15</td><td class="n">06:50</td><td class="n">Daily</td></tr>
        <tr><td>Munich to Rome</td><td class="n">22:10</td><td class="n">08:40</td><td class="n">Thu to Mon</td></tr>
        <tr><td>Budapest to Zagreb</td><td class="n">22:40</td><td class="n">06:30</td><td class="n">Daily</td></tr>
      </tbody>
    </table>
  </div>
</section>

<section id="night" class="night">
  <div class="bg" data-par="0.2"><img src="https://images.pexels.com/photos/13778131/pexels-photo-13778131.jpeg?auto=compress&cs=tinysrgb&w=2000" alt="" width="2000" height="1125" loading="lazy"></div>
  <div class="wrap">
    <h2 class="rv">What the night gives back</h2>
    <p class="lede rv">One hotel night saved, one morning that starts in the place you came to see.</p>
    <div class="clock">
      <div class="rv"><b>21:40</b><span>Board with a coffee in your hand. Your bunk is made, your bag is already in it.</span></div>
      <div class="rv"><b>00:15</b><span>Lights go down. The conductor has your passport and, if you asked, a wake-up time.</span></div>
      <div class="rv"><b>07:50</b><span>Fresh rolls on the way in, the old town out of the window, nothing on your calendar until ten.</span></div>
    </div>
  </div>
</section>

<section id="book" class="paper">
  <div class="wrap book">
    <div>
      <h2 class="rv">Check the board for your night</h2>
      <p class="lede rv">Pick a route and a berth. Your choice goes straight onto the board above.</p>
    </div>
    <form class="rv" id="f" onsubmit="return false" novalidate>
      <div class="two">
        <label>Leaving from
          <select id="from"><option>Amsterdam</option><option>Hamburg</option><option>Barcelona</option><option>Prague</option><option>Munich</option><option>Budapest</option></select>
        </label>
        <label>Going to
          <select id="to"><option>Vienna</option><option>Zurich</option><option>Milan</option><option>Krakow</option><option>Rome</option><option>Zagreb</option></select>
        </label>
      </div>
      <label>Night of travel <input type="date" id="date"></label>
      <div class="fl" role="group" aria-label="Berth">Berth
        <div class="chips">
          <label><input type="radio" name="b" value="Seat"><span>SEAT</span></label>
          <label><input type="radio" name="b" value="Couchette" checked><span>COUCHETTE</span></label>
          <label><input type="radio" name="b" value="Sleeper"><span>SLEEPER</span></label>
        </div>
      </div>
      <div><button class="btn dark" type="submit" data-flap><span class="lbl">Check the board</span></button></div>
      <p id="msg" role="status" aria-live="polite"></p>
    </form>
  </div>
</section>
</main>

<footer>
  <div class="wrap">
    <div>
      <p class="big">Nightjar</p>
      <p style="margin-top:.8rem">Nightjar is a concept brand and this page is a free template. Fares, routes and times are placeholders to replace with your own.</p>
    </div>
    <p>Photography from <a href="https://www.pexels.com">Pexels</a>: <a href="https://www.pexels.com/@matreding">Mathias Reding</a>, <a href="https://www.pexels.com/@nguyendesigner">Pew Nguyen</a>, <a href="https://www.pexels.com/@takehiro-yokozeki-18135683">Takehiro Yokozeki</a>, <a href="https://www.pexels.com/@kazi-omar-sany-219259388">Kazi Omar Sany</a>.</p>
  </div>
</footer>

<div id="coord" aria-hidden="true">47.20N 08.55E</div>

<script>
(function(){
var d=document,root=d.documentElement,rm=matchMedia('(prefers-reduced-motion: reduce)').matches;
root.classList.add('js');

/* split-flap button labels */
d.querySelectorAll('[data-flap]').forEach(function(btn){
  var lbl=btn.querySelector('.lbl'),t=lbl.textContent.trim();
  btn.setAttribute('aria-label',t);lbl.textContent='';lbl.setAttribute('aria-hidden','true');
  t.split('').forEach(function(c,i){
    var s=d.createElement('span');s.className='tile'+(c===' '?' sp':'');s.style.setProperty('--i',i);
    s.innerHTML='<span class="a">'+c+'</span><span class="b">'+c+'</span>';lbl.appendChild(s);
  });
});

/* departures board */
var board=d.getElementById('board'),rows=[].slice.call(board.querySelectorAll('.row')),COLS=18;
var glyphs=' ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:';
var sets=[
  [['21:40','VIENNA',4],['21:55','ZAGREB',2],['22:10','MUNICH',7],['22:30','HAMBURG',1]],
  [['21:45','AMSTERDAM',3],['22:00','MILAN',6],['22:20','PRAGUE',5],['22:35','ROME',8]],
  [['21:50','BARCELONA',2],['22:05','ZURICH',4],['22:15','KRAKOW',1],['22:40','BUDAPEST',7]]
];
function line(r){return (r[0]+' '+r[1]).padEnd(COLS-3)+' P'+r[2]}
function half(cls,ch){return '<span class="h '+cls+'"><b>'+ch+'</b></span>'}
function build(row,text){
  row.setAttribute('aria-label',text.trim());row.textContent='';
  text.split('').forEach(function(ch){
    var c=d.createElement('span');c.className='cell';c.setAttribute('aria-hidden','true');c.dataset.c=ch;
    c.innerHTML=half('top',ch)+half('bot',ch)+half('ft',ch)+half('fb',ch);
    row.appendChild(c);
  });
}
function paint(cell,top,bot,ft,fb){
  var h=cell.children;h[0].firstChild.textContent=top;h[1].firstChild.textContent=bot;h[2].firstChild.textContent=ft;h[3].firstChild.textContent=fb;
}
function flip(cell,next,done){
  var cur=cell.dataset.c;if(cur===next){done&&done();return}
  if(rm){paint(cell,next,next,next,next);cell.dataset.c=next;done&&done();return}
  paint(cell,next,cur,cur,next);cell.classList.add('go');
  setTimeout(function(){cell.classList.remove('go');paint(cell,next,next,next,next);cell.dataset.c=next;done&&done()},235);
}
function setRow(row,text,delay){
  row.setAttribute('aria-label',text.trim());
  [].forEach.call(row.children,function(cell,i){
    var ch=text.charAt(i)||' ';if(cell.dataset.c===ch)return;
    setTimeout(function(){
      if(rm){flip(cell,ch);return}
      var mid=glyphs.charAt(Math.floor(Math.random()*glyphs.length));
      flip(cell,mid,function(){flip(cell,ch)});
    },delay+i*28);
  });
}
rows.forEach(function(r,i){build(r,line(sets[0][i]))});
var n=0,timer;
function next(){n=(n+1)%sets.length;rows.forEach(function(r,i){setRow(r,line(sets[n][i]),i*160)})}
if(!rm){timer=setInterval(next,5200)}

/* booking form drives the board */
var f=d.getElementById('f'),msg=d.getElementById('msg'),dt=d.getElementById('date');
var tomorrow=new Date(Date.now()+864e5);dt.value=tomorrow.toISOString().slice(0,10);dt.min=new Date().toISOString().slice(0,10);
f.addEventListener('submit',function(e){
  e.preventDefault();clearInterval(timer);
  var from=d.getElementById('from').value,to=d.getElementById('to').value,b=f.b.value;
  var r=['22:05',to.toUpperCase().slice(0,9),6];
  setRow(rows[0],line(r),0);
  msg.textContent=from+' to '+to+', '+b.toLowerCase()+', leaves 22:05 from platform 6 on '+dt.value+'. This is a template, so nothing is booked.';
  board.scrollIntoView({behavior:rm?'auto':'smooth',block:'center'});
});

/* reveal */
if('IntersectionObserver' in window){
  var io=new IntersectionObserver(function(es){es.forEach(function(e){if(e.isIntersecting){e.target.classList.add('in');io.unobserve(e.target)}})},{threshold:.15});
  d.querySelectorAll('.rv,.win').forEach(function(el){io.observe(el)});
}else{d.querySelectorAll('.rv,.win').forEach(function(el){el.classList.add('in')})}

/* parallax */
var pars=[].slice.call(d.querySelectorAll('[data-par]')),tick=false;
function par(){
  tick=false;var vh=innerHeight;
  pars.forEach(function(el){
    var p=el.parentElement.getBoundingClientRect();
    if(p.bottom<-200||p.top>vh+200)return;
    var lim=el.offsetHeight*0.1,off=(p.top+p.height/2-vh/2)*parseFloat(el.dataset.par);
    off=Math.max(-lim,Math.min(lim,off));
    el.style.transform='translate3d(0,'+(-off).toFixed(1)+'px,0)';
  });
}
if(!rm){addEventListener('scroll',function(){if(!tick){tick=true;requestAnimationFrame(par)}},{passive:true});addEventListener('resize',par);par()}

/* cursor coordinates */
var c=d.getElementById('coord');
if(!rm&&matchMedia('(hover:hover)').matches){
  var mx=0,my=0,q=false;
  addEventListener('pointermove',function(e){
    mx=e.clientX;my=e.clientY;
    if(!q){q=true;requestAnimationFrame(function(){
      q=false;
      var lat=(60-(my/innerHeight)*22).toFixed(2),lon=(-8+(mx/innerWidth)*38).toFixed(2);
      c.textContent=lat+'N '+(lon<0?Math.abs(lon).toFixed(2)+'W':(+lon).toFixed(2)+'E');
      c.style.transform='translate('+(mx+16)+'px,'+(my+16)+'px)';c.style.opacity=1;
    })}
  },{passive:true});
  d.addEventListener('pointerleave',function(){c.style.opacity=0});
}
})();
</script>
</body>
</html>

Brand kit

The identity behind this design, ready to use: logo lockups, colour roles with contrast scores, the type scale, buttons and fields, photo treatment, motion rules, design tokens, and five ready-sized social templates.

Colour roles

  • Ink#0f1424
  • Paper#f2ead8
  • Accent#ffb238
  • Support 1#e4452f
  • Support 2#2c6e68

Type

Display
Fraunces
Body
Hanken Grotesk

Social templates