Boutique hotel page with a sun-path day
A sunlit coast hotel site: drag the sun across the sky and the section re-lights from dawn to night, plus a floating room reveal and a date-range booking strip.
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type PointerEvent as ReactPointerEvent,
} from "react";
import "./hotel-page.css";
/**
* HotelPage: a quiet, sunlit page for a seven-room coast hotel ("Casa Alba").
* Its signature is "A day here": drag the sun across the sky and the whole
* section re-lights from dawn to night while the moment and photo change.
* It is a demo: connect `onRequest` to your booking tool.
*/
const IMG = {
room: "/images/landing-hotel-hero-06.jpg",
pool: "/images/landing-hotel-pool-07.jpg",
breakfast: "/images/landing-hotel-breakfast-08.jpg",
basin: "/images/landing-hotel-detail-09.jpg",
};
const MOMENTS = [
{
at: 7.5,
title: "Breakfast under the vine",
text: "Figs from the garden, yoghurt, warm bread and coffee from the moka pot.",
img: IMG.breakfast,
alt: "Breakfast for two on a shaded stone terrace under a vine",
tone: "#c99a64",
},
{
at: 11,
title: "A swim in the rock pool",
text: "Cut into the cliff above the water. Usually you'll have it to yourself.",
img: IMG.pool,
alt: "A small stone pool cut into the rocks above the sea",
tone: "#6f93a6",
},
{
at: 15,
title: "Siesta behind the shutters",
text: "Thick lime walls keep every room cool, even in August.",
img: IMG.room,
alt: "A limewashed room with blue shutters open to the sea",
tone: "#d9c9ae",
},
{
at: 19.5,
title: "Sunset by the water",
text: "A glass of something cold while the sea goes from blue to peach.",
img: IMG.pool,
alt: "The rock pool at dusk under a pale peach sky",
tone: "#c98a74",
},
{
at: 22,
title: "A slow bath, then sleep",
text: "Stone basins, linen sheets and only the sound of the waves.",
img: IMG.basin,
alt: "A carved stone basin with a brass tap set into a lime wall",
tone: "#3a4152",
},
];
/** Sky colours through the day: hour, top, horizon, text. */
const SKY: [number, string, string, string][] = [
[6, "#f6c9a8", "#fbe7d4", "#2a211c"],
[9, "#bcd7e6", "#f4efe4", "#1d2228"],
[14, "#9cc6e2", "#f2f0e8", "#1d2228"],
[18.5, "#f0a982", "#f9d9b8", "#2a1d18"],
[20.5, "#5b4a7a", "#e59d7c", "#fbf3ea"],
[22, "#141b33", "#36395e", "#f3eee3"],
];
const MIN = 6;
const MAX = 22;
/** Blends in OKLCH, so dusk passes through warm pinks instead of grey. */
const mix = (a: string, b: string, t: number) =>
`color-mix(in oklch, ${b} ${(t * 100).toFixed(1)}%, ${a})`;
function skyAt(h: number) {
let i = 0;
while (i < SKY.length - 2 && h > SKY[i + 1][0]) i++;
const [h0, t0, b0, f0] = SKY[i];
const [h1, t1, b1, f1] = SKY[i + 1];
const t = Math.min(1, Math.max(0, (h - h0) / (h1 - h0)));
return {
top: mix(t0, t1, t),
bottom: mix(b0, b1, t),
ink: t < 0.5 ? f0 : f1,
};
}
const clock = (h: number) =>
`${Math.floor(h)}:${String(Math.round((h % 1) * 60) % 60).padStart(2, "0")}`;
function momentAt(h: number) {
let m = 0;
MOMENTS.forEach((x, i) => {
if (h >= x.at - 1.25) m = i;
});
return m;
}
/* ------------------------------------------------------------------ */
function Photo({
src,
alt,
tone,
className = "",
eager = false,
}: {
src: string;
alt: string;
tone: string;
className?: string;
eager?: boolean;
}) {
const img = useRef<HTMLImageElement>(null);
const [missing, setMissing] = useState(false);
useEffect(() => {
const el = img.current;
if (el && el.complete && el.naturalWidth === 0) setMissing(true);
}, []);
return (
<div
className={`gu-alba__photo ${className}`}
style={{ "--tone": tone } as CSSProperties}
>
{!missing && (
<img
ref={img}
src={src}
alt={alt}
loading={eager ? "eager" : "lazy"}
onError={() => setMissing(true)}
/>
)}
</div>
);
}
/* ------------------------------------------------------------------ */
function DayHere() {
const [hour, setHour] = useState(7.5);
const [section, setSection] = useState<HTMLElement | null>(null);
const touched = useRef(false);
const arc = useRef<SVGSVGElement>(null);
const dragging = useRef(false);
// When nobody is steering, the sun drifts across the sky on its own.
useEffect(() => {
if (
!section ||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
)
return;
let raf = 0;
let last = 0;
let visible = false;
const io = new IntersectionObserver(([e]) => (visible = e.isIntersecting), {
threshold: 0.4,
});
io.observe(section);
const tick = (now: number) => {
const dt = last ? Math.min(64, now - last) : 0;
last = now;
if (visible && !touched.current) {
setHour((h) => (h + dt * 0.0009 > MAX ? MIN : h + dt * 0.0009));
}
raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(raf);
io.disconnect();
};
}, [section]);
const steer = (h: number) => {
touched.current = true;
setHour(Math.min(MAX, Math.max(MIN, h)));
};
const fromPointer = (e: ReactPointerEvent) => {
const svg = arc.current;
if (!svg) return;
const r = svg.getBoundingClientRect();
const cx = r.left + r.width / 2;
const cy = r.top + r.height * (300 / 320);
const a = Math.atan2(cy - e.clientY, e.clientX - cx); // 0 right .. π left
const t =
1 -
Math.min(Math.PI, Math.max(0, a < -Math.PI / 2 ? Math.PI : a)) / Math.PI;
steer(MIN + t * (MAX - MIN));
};
const t = (hour - MIN) / (MAX - MIN);
const ang = Math.PI * (1 - t);
const sx = 300 + Math.cos(ang) * 260;
const sy = 300 - Math.sin(ang) * 260;
const sky = skyAt(hour);
const now = momentAt(hour);
const m = MOMENTS[now];
const night = hour > 20.4;
return (
<section
ref={setSection}
className="gu-alba__day"
aria-labelledby="alba-day-title"
style={
{
"--top": sky.top,
"--bottom": sky.bottom,
"--ink": sky.ink,
} as CSSProperties
}
data-night={night}
>
<div className="gu-alba__day-head">
<h2 id="alba-day-title" className="gu-alba__h2">
A day here.
</h2>
<p className="gu-alba__clock" aria-hidden="true">
{clock(hour)}
</p>
</div>
<div className="gu-alba__day-grid">
<div className="gu-alba__sky">
<svg
ref={arc}
viewBox="0 0 600 320"
className="gu-alba__arc"
onPointerDown={(e) => {
dragging.current = true;
e.currentTarget.setPointerCapture(e.pointerId);
fromPointer(e);
}}
onPointerMove={(e) => dragging.current && fromPointer(e)}
onPointerUp={() => (dragging.current = false)}
onPointerCancel={() => (dragging.current = false)}
>
<path
d="M40 300 A260 260 0 0 1 560 300"
className="gu-alba__path"
/>
<path
d="M40 300 A260 260 0 0 1 560 300"
className="gu-alba__path-done"
pathLength={1}
style={{ strokeDasharray: `${t} 1` }}
/>
{MOMENTS.map((x) => {
const a = Math.PI * (1 - (x.at - MIN) / (MAX - MIN));
return (
<circle
key={x.title}
cx={300 + Math.cos(a) * 260}
cy={300 - Math.sin(a) * 260}
r="5"
className="gu-alba__tick"
/>
);
})}
<line
x1="0"
y1="300"
x2="600"
y2="300"
className="gu-alba__horizon"
/>
<g
className="gu-alba__sun"
transform={`translate(${sx} ${sy})`}
role="slider"
tabIndex={0}
aria-label="Time of day"
aria-valuemin={MIN}
aria-valuemax={MAX}
aria-valuenow={Math.round(hour * 4) / 4}
aria-valuetext={`${clock(hour)}, ${m.title}`}
onKeyDown={(e) => {
const step = {
ArrowRight: 0.25,
ArrowUp: 0.25,
ArrowLeft: -0.25,
ArrowDown: -0.25,
PageUp: 1,
PageDown: -1,
}[e.key];
if (step) {
e.preventDefault();
steer(hour + step);
} else if (e.key === "Home") steer(MIN);
else if (e.key === "End") steer(MAX);
}}
>
<circle r="44" className="gu-alba__sun-glow" />
<circle r="24" className="gu-alba__sun-body" />
<circle r="24" cx="12" cy="-8" className="gu-alba__moon-bite" />
</g>
</svg>
<p className="gu-alba__hint" aria-hidden="true">
Drag the sun
</p>
</div>
<div className="gu-alba__moment">
<div className="gu-alba__frames">
{MOMENTS.map((x, i) => (
<div
key={x.title}
className="gu-alba__frame"
data-on={i === now}
aria-hidden={i !== now}
>
<Photo src={x.img} alt={x.alt} tone={x.tone} />
</div>
))}
</div>
<div aria-live="polite" className="gu-alba__moment-text" key={now}>
<p className="gu-alba__time">{clock(m.at)}</p>
<h3>{m.title}</h3>
<p>{m.text}</p>
</div>
<ol className="gu-alba__times" aria-label="Moments of the day">
{MOMENTS.map((x, i) => (
<li key={x.title}>
<button
type="button"
aria-pressed={i === now}
onClick={() => steer(x.at)}
>
{clock(x.at)}
</button>
</li>
))}
</ol>
</div>
</div>
</section>
);
}
/* ------------------------------------------------------------------ */
const ROOMS = [
{
name: "Sea room",
size: "24 m²",
sleeps: "Sleeps 2",
price: 180,
img: IMG.room,
tone: "#d9c9ae",
alt: "Sea room with blue shutters",
},
{
name: "Garden room",
size: "28 m²",
sleeps: "Sleeps 2 + a child",
price: 210,
img: IMG.breakfast,
tone: "#c99a64",
alt: "The terrace outside the garden room",
},
{
name: "Tower suite",
size: "46 m²",
sleeps: "Sleeps 4",
price: 340,
img: IMG.basin,
tone: "#a7988a",
alt: "The suite's stone basin",
},
];
function Rooms() {
const [hover, setHover] = useState<number | null>(null);
const float = useRef<HTMLDivElement>(null);
return (
<section className="gu-alba__rooms" aria-labelledby="alba-rooms-title">
<h2 id="alba-rooms-title" className="gu-alba__h2">
Seven rooms, three kinds.
</h2>
<div
className="gu-alba__room-wrap"
onPointerMove={(e) => {
const el = float.current;
if (!el || e.pointerType !== "mouse") return;
const r = e.currentTarget.getBoundingClientRect();
el.style.translate = `${e.clientX - r.left}px ${e.clientY - r.top}px`;
}}
onPointerLeave={() => setHover(null)}
>
<ul className="gu-alba__room-list">
{ROOMS.map((r, i) => (
<li
key={r.name}
onPointerEnter={(e) => e.pointerType === "mouse" && setHover(i)}
>
<Photo
src={r.img}
alt={r.alt}
tone={r.tone}
className="gu-alba__room-thumb"
/>
<h3>{r.name}</h3>
<p>
{r.size}, {r.sleeps.toLowerCase()}
</p>
<p className="gu-alba__room-price">
from <strong>€{r.price}</strong> a night
</p>
</li>
))}
</ul>
<div
ref={float}
className="gu-alba__float"
data-on={hover !== null}
aria-hidden="true"
>
{ROOMS.map((r, i) => (
<div key={r.name} data-on={hover === i}>
<Photo src={r.img} alt="" tone={r.tone} />
</div>
))}
</div>
</div>
</section>
);
}
/* ------------------------------------------------------------------ */
const NIGHT_RATE = 180;
const fmt = new Intl.DateTimeFormat("en-GB", {
weekday: "short",
day: "numeric",
});
const fmtLong = new Intl.DateTimeFormat("en-GB", {
day: "numeric",
month: "short",
});
function Booking({
onRequest,
}: {
onRequest?: (stay: { from: Date; to: Date; guests: number }) => void;
}) {
const [start, setStart] = useState<Date | null>(null);
const [inDay, setIn] = useState<number | null>(null);
const [outDay, setOut] = useState<number | null>(null);
const [guests, setGuests] = useState(2);
const [sent, setSent] = useState(false);
// Dates depend on today, so they're made in the browser only.
useEffect(() => {
const d = new Date();
d.setHours(0, 0, 0, 0);
d.setDate(d.getDate() + 3);
const id = requestAnimationFrame(() => setStart(d));
return () => cancelAnimationFrame(id);
}, []);
const day = (i: number) => {
const d = new Date(start ?? 0);
d.setDate(d.getDate() + i);
return d;
};
const pick = (i: number) => {
if (inDay === null || outDay !== null || i <= inDay) {
setIn(i);
setOut(null);
} else setOut(i);
};
const nights = inDay !== null && outDay !== null ? outDay - inDay : 0;
if (sent && inDay !== null && outDay !== null)
return (
<div className="gu-alba__book is-sent" role="status">
<p className="gu-alba__h3">Request sent.</p>
<p>
{nights} nights for {guests}, {fmtLong.format(day(inDay))} to{" "}
{fmtLong.format(day(outDay))}. We'll write within a day to
confirm.
</p>
<button
type="button"
className="gu-alba__link"
onClick={() => setSent(false)}
>
Change dates
</button>
</div>
);
return (
<form
className="gu-alba__book"
onSubmit={(e) => {
e.preventDefault();
if (!nights || inDay === null || outDay === null) return;
setSent(true);
onRequest?.({ from: day(inDay), to: day(outDay), guests });
}}
>
<div className="gu-alba__book-row">
<p className="gu-alba__h3">
{inDay === null
? "Choose your first night"
: outDay === null
? "Now choose your last morning"
: `${nights} nights`}
</p>
<div className="gu-alba__guests" role="group" aria-label="Guests">
<button
type="button"
aria-label="Fewer guests"
onClick={() => setGuests((g) => Math.max(1, g - 1))}
>
−
</button>
<output aria-live="polite">{guests} guests</output>
<button
type="button"
aria-label="More guests"
onClick={() => setGuests((g) => Math.min(4, g + 1))}
>
+
</button>
</div>
</div>
<div className="gu-alba__strip" role="group" aria-label="Dates">
{start &&
Array.from({ length: 14 }, (_, i) => {
const d = day(i);
const edge = i === inDay || i === outDay;
const inside =
inDay !== null && outDay !== null && i > inDay && i < outDay;
return (
<button
key={i}
type="button"
aria-pressed={edge || inside}
data-edge={edge}
data-inside={inside}
onClick={() => pick(i)}
style={{ "--i": i } as CSSProperties}
>
<span>{fmt.format(d).split(" ")[0]}</span>
<strong>{d.getDate()}</strong>
</button>
);
})}
</div>
<div className="gu-alba__book-row">
<p className="gu-alba__total">
{nights ? (
<>
<strong>€{nights * NIGHT_RATE}</strong> for {nights} nights,
breakfast included
</>
) : (
<>Sea rooms from €{NIGHT_RATE} a night, breakfast included</>
)}
</p>
<button type="submit" className="gu-alba__cta" disabled={!nights}>
{nights ? "Request these dates" : "Pick your dates"}
</button>
</div>
</form>
);
}
/* ------------------------------------------------------------------ */
export function HotelPage({
onRequest,
}: {
onRequest?: (stay: { from: Date; to: Date; guests: number }) => void;
}) {
return (
<div className="gu-alba">
<header className="gu-alba__hero">
<Photo
src={IMG.room}
alt="A limewashed room with faded blue shutters open onto a calm sea"
tone="#d9c9ae"
className="gu-alba__hero-photo"
eager
/>
<nav className="gu-alba__nav" aria-label="Main">
<a href="#" className="gu-alba__logo">
Casa Alba
</a>
<a href="#alba-book" className="gu-alba__pill">
Book a room
</a>
</nav>
<div className="gu-alba__hero-copy">
<p>A small hotel on the southern cliffs</p>
<h1 className="gu-alba__h1">Seven rooms above the sea.</h1>
</div>
</header>
<section className="gu-alba__intro">
<p>
A farmhouse of thick white walls, rebuilt slowly over ten years. No
TV, no lobby music, no buffet. Just shutters, the sea and very good
bread.
</p>
</section>
<DayHere />
<Rooms />
<section
className="gu-alba__booking"
id="alba-book"
aria-labelledby="alba-book-title"
>
<h2 id="alba-book-title" className="gu-alba__h2">
Come and stay.
</h2>
<Booking onRequest={onRequest} />
</section>
<footer className="gu-alba__foot">
<p className="gu-alba__logo">Casa Alba</p>
<p>Open from April to October. Two nights minimum in summer.</p>
</footer>
</div>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Boutique hotel page with a sun-path day
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A quiet, sunlit one-page site for a seven-room hotel on a rocky coast ("Casa Alba"). Its signature is "A day here": a sun sits on a dotted arc above a horizon line, and dragging it from 6:00 to 22:00 re-lights the whole section, blending the background from dawn peach through noon blue and dusk coral to night navy, with the text flipping to cream after sunset. A big clock, a crossfading photo and a short story follow the time. When nobody touches it, the sun drifts across on its own. Other sections: a full photo hero, a one-sentence intro, a room list with a floating photo that follows the cursor, a 14-day date-range booking strip, and a footer.
## Palette
Background #f6f2ea, stone #e9e1d3, ink #1f2226, muted #6a6560, sea blue #2f5f86 (chosen dates, focus of the booking), focus ring #2b35ff. Sky stops (hour, top, horizon): 6 #f6c9a8/#fbe7d4, 9 #bcd7e6/#f4efe4, 14 #9cc6e2/#f2f0e8, 18.5 #f0a982/#f9d9b8, 20.5 #5b4a7a/#e59d7c, 22 #141b33/#36395e. Headings use a serif stack ("Iowan Old Style", Palatino, Georgia); the rest is system-ui.
## Layout
- Hero: at least 700px tall, with the room photo slowly drifting and zooming under a top and bottom shade. Nav: a small-caps serif logo and a cream "Book a room" pill. Bottom left: a small line and a serif headline up to 8rem, max 11ch.
- Intro: one centred serif paragraph, max 30ch.
- A day here: the heading and a large tabular clock on one row. Below, at 900px and wider, two columns:
- The SVG arc (600×320): a dotted path, a solid path that fills up to the sun (pathLength 1), dots for the five moments, a horizon line, and the sun with a pulsing glow. At night it becomes a moon by overlapping a sky-coloured circle.
- A 4:3 photo stack that crossfades with a slight zoom, the moment's time, title and text, and five time chips that jump the sun there.
- Rooms: a heading, then a list of three rows (serif name, size, "from €180 a night" on the right). On hover devices a 4:5 photo floats after the cursor, tilts in and wipes up between rooms; the other rows dim and the hovered row shifts right. On touch screens each row shows its photo inline.
- Booking (stone band): the heading beside a card with a prompt line ("Choose your first night", then "Now choose your last morning", then "3 nights"), a guest stepper (1 to 4), a 7×2 grid of date buttons (day name and number), a total (nights × €180) and a dark "Request these dates" button that is disabled until a range is chosen. After sending, the card turns into a confirmation with a sea-blue border.
## Images
- landing-hotel-hero-06.jpg (16:9): the room.
- landing-hotel-pool-07.jpg (4:5): the pool at dusk.
- landing-hotel-breakfast-08.jpg (4:3): breakfast.
- landing-hotel-detail-09.jpg (1:1): the stone basin.
Until a file exists, each frame shows a toned gradient.
## Motion
- The hero photo breathes for 18s, alternating, and the hero text rises out of a blur.
- The sun drifts about 0.9 hours a second while the section is in view and untouched, and stops for good once someone drags it, uses the keys or presses a chip.
- Photos crossfade over 0.9s and the moment text rises.
- The floating room photo scales, tilts and wipes between rooms. Date buttons rise in 30ms steps.
## Accessibility
- The sun is a focusable role="slider" with aria-valuetext ("7:30, Breakfast under the vine"). Arrows move it 15 minutes, Page Up and Page Down an hour, Home and End go to the start and end.
- The moment text is aria-live="polite", and the time chips use aria-pressed.
- Booking dates use aria-pressed, the guest count is an output, and the confirmation has role="status".
- prefers-reduced-motion: no drift, breathing or fades.
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### HotelPage.tsx
```tsx
"use client";
import {
useEffect,
useRef,
useState,
type CSSProperties,
type PointerEvent as ReactPointerEvent,
} from "react";
import "./hotel-page.css";
/**
* HotelPage: a quiet, sunlit page for a seven-room coast hotel ("Casa Alba").
* Its signature is "A day here": drag the sun across the sky and the whole
* section re-lights from dawn to night while the moment and photo change.
* It is a demo: connect `onRequest` to your booking tool.
*/
const IMG = {
room: "/images/landing-hotel-hero-06.jpg",
pool: "/images/landing-hotel-pool-07.jpg",
breakfast: "/images/landing-hotel-breakfast-08.jpg",
basin: "/images/landing-hotel-detail-09.jpg",
};
const MOMENTS = [
{
at: 7.5,
title: "Breakfast under the vine",
text: "Figs from the garden, yoghurt, warm bread and coffee from the moka pot.",
img: IMG.breakfast,
alt: "Breakfast for two on a shaded stone terrace under a vine",
tone: "#c99a64",
},
{
at: 11,
title: "A swim in the rock pool",
text: "Cut into the cliff above the water. Usually you'll have it to yourself.",
img: IMG.pool,
alt: "A small stone pool cut into the rocks above the sea",
tone: "#6f93a6",
},
{
at: 15,
title: "Siesta behind the shutters",
text: "Thick lime walls keep every room cool, even in August.",
img: IMG.room,
alt: "A limewashed room with blue shutters open to the sea",
tone: "#d9c9ae",
},
{
at: 19.5,
title: "Sunset by the water",
text: "A glass of something cold while the sea goes from blue to peach.",
img: IMG.pool,
alt: "The rock pool at dusk under a pale peach sky",
tone: "#c98a74",
},
{
at: 22,
title: "A slow bath, then sleep",
text: "Stone basins, linen sheets and only the sound of the waves.",
img: IMG.basin,
alt: "A carved stone basin with a brass tap set into a lime wall",
tone: "#3a4152",
},
];
/** Sky colours through the day: hour, top, horizon, text. */
const SKY: [number, string, string, string][] = [
[6, "#f6c9a8", "#fbe7d4", "#2a211c"],
[9, "#bcd7e6", "#f4efe4", "#1d2228"],
[14, "#9cc6e2", "#f2f0e8", "#1d2228"],
[18.5, "#f0a982", "#f9d9b8", "#2a1d18"],
[20.5, "#5b4a7a", "#e59d7c", "#fbf3ea"],
[22, "#141b33", "#36395e", "#f3eee3"],
];
const MIN = 6;
const MAX = 22;
/** Blends in OKLCH, so dusk passes through warm pinks instead of grey. */
const mix = (a: string, b: string, t: number) =>
`color-mix(in oklch, ${b} ${(t * 100).toFixed(1)}%, ${a})`;
function skyAt(h: number) {
let i = 0;
while (i < SKY.length - 2 && h > SKY[i + 1][0]) i++;
const [h0, t0, b0, f0] = SKY[i];
const [h1, t1, b1, f1] = SKY[i + 1];
const t = Math.min(1, Math.max(0, (h - h0) / (h1 - h0)));
return {
top: mix(t0, t1, t),
bottom: mix(b0, b1, t),
ink: t < 0.5 ? f0 : f1,
};
}
const clock = (h: number) =>
`${Math.floor(h)}:${String(Math.round((h % 1) * 60) % 60).padStart(2, "0")}`;
function momentAt(h: number) {
let m = 0;
MOMENTS.forEach((x, i) => {
if (h >= x.at - 1.25) m = i;
});
return m;
}
/* ------------------------------------------------------------------ */
function Photo({
src,
alt,
tone,
className = "",
eager = false,
}: {
src: string;
alt: string;
tone: string;
className?: string;
eager?: boolean;
}) {
const img = useRef<HTMLImageElement>(null);
const [missing, setMissing] = useState(false);
useEffect(() => {
const el = img.current;
if (el && el.complete && el.naturalWidth === 0) setMissing(true);
}, []);
return (
<div
className={`gu-alba__photo ${className}`}
style={{ "--tone": tone } as CSSProperties}
>
{!missing && (
<img
ref={img}
src={src}
alt={alt}
loading={eager ? "eager" : "lazy"}
onError={() => setMissing(true)}
/>
)}
</div>
);
}
/* ------------------------------------------------------------------ */
function DayHere() {
const [hour, setHour] = useState(7.5);
const [section, setSection] = useState<HTMLElement | null>(null);
const touched = useRef(false);
const arc = useRef<SVGSVGElement>(null);
const dragging = useRef(false);
// When nobody is steering, the sun drifts across the sky on its own.
useEffect(() => {
if (
!section ||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
)
return;
let raf = 0;
let last = 0;
let visible = false;
const io = new IntersectionObserver(([e]) => (visible = e.isIntersecting), {
threshold: 0.4,
});
io.observe(section);
const tick = (now: number) => {
const dt = last ? Math.min(64, now - last) : 0;
last = now;
if (visible && !touched.current) {
setHour((h) => (h + dt * 0.0009 > MAX ? MIN : h + dt * 0.0009));
}
raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(raf);
io.disconnect();
};
}, [section]);
const steer = (h: number) => {
touched.current = true;
setHour(Math.min(MAX, Math.max(MIN, h)));
};
const fromPointer = (e: ReactPointerEvent) => {
const svg = arc.current;
if (!svg) return;
const r = svg.getBoundingClientRect();
const cx = r.left + r.width / 2;
const cy = r.top + r.height * (300 / 320);
const a = Math.atan2(cy - e.clientY, e.clientX - cx); // 0 right .. π left
const t =
1 -
Math.min(Math.PI, Math.max(0, a < -Math.PI / 2 ? Math.PI : a)) / Math.PI;
steer(MIN + t * (MAX - MIN));
};
const t = (hour - MIN) / (MAX - MIN);
const ang = Math.PI * (1 - t);
const sx = 300 + Math.cos(ang) * 260;
const sy = 300 - Math.sin(ang) * 260;
const sky = skyAt(hour);
const now = momentAt(hour);
const m = MOMENTS[now];
const night = hour > 20.4;
return (
<section
ref={setSection}
className="gu-alba__day"
aria-labelledby="alba-day-title"
style={
{
"--top": sky.top,
"--bottom": sky.bottom,
"--ink": sky.ink,
} as CSSProperties
}
data-night={night}
>
<div className="gu-alba__day-head">
<h2 id="alba-day-title" className="gu-alba__h2">
A day here.
</h2>
<p className="gu-alba__clock" aria-hidden="true">
{clock(hour)}
</p>
</div>
<div className="gu-alba__day-grid">
<div className="gu-alba__sky">
<svg
ref={arc}
viewBox="0 0 600 320"
className="gu-alba__arc"
onPointerDown={(e) => {
dragging.current = true;
e.currentTarget.setPointerCapture(e.pointerId);
fromPointer(e);
}}
onPointerMove={(e) => dragging.current && fromPointer(e)}
onPointerUp={() => (dragging.current = false)}
onPointerCancel={() => (dragging.current = false)}
>
<path
d="M40 300 A260 260 0 0 1 560 300"
className="gu-alba__path"
/>
<path
d="M40 300 A260 260 0 0 1 560 300"
className="gu-alba__path-done"
pathLength={1}
style={{ strokeDasharray: `${t} 1` }}
/>
{MOMENTS.map((x) => {
const a = Math.PI * (1 - (x.at - MIN) / (MAX - MIN));
return (
<circle
key={x.title}
cx={300 + Math.cos(a) * 260}
cy={300 - Math.sin(a) * 260}
r="5"
className="gu-alba__tick"
/>
);
})}
<line
x1="0"
y1="300"
x2="600"
y2="300"
className="gu-alba__horizon"
/>
<g
className="gu-alba__sun"
transform={`translate(${sx} ${sy})`}
role="slider"
tabIndex={0}
aria-label="Time of day"
aria-valuemin={MIN}
aria-valuemax={MAX}
aria-valuenow={Math.round(hour * 4) / 4}
aria-valuetext={`${clock(hour)}, ${m.title}`}
onKeyDown={(e) => {
const step = {
ArrowRight: 0.25,
ArrowUp: 0.25,
ArrowLeft: -0.25,
ArrowDown: -0.25,
PageUp: 1,
PageDown: -1,
}[e.key];
if (step) {
e.preventDefault();
steer(hour + step);
} else if (e.key === "Home") steer(MIN);
else if (e.key === "End") steer(MAX);
}}
>
<circle r="44" className="gu-alba__sun-glow" />
<circle r="24" className="gu-alba__sun-body" />
<circle r="24" cx="12" cy="-8" className="gu-alba__moon-bite" />
</g>
</svg>
<p className="gu-alba__hint" aria-hidden="true">
Drag the sun
</p>
</div>
<div className="gu-alba__moment">
<div className="gu-alba__frames">
{MOMENTS.map((x, i) => (
<div
key={x.title}
className="gu-alba__frame"
data-on={i === now}
aria-hidden={i !== now}
>
<Photo src={x.img} alt={x.alt} tone={x.tone} />
</div>
))}
</div>
<div aria-live="polite" className="gu-alba__moment-text" key={now}>
<p className="gu-alba__time">{clock(m.at)}</p>
<h3>{m.title}</h3>
<p>{m.text}</p>
</div>
<ol className="gu-alba__times" aria-label="Moments of the day">
{MOMENTS.map((x, i) => (
<li key={x.title}>
<button
type="button"
aria-pressed={i === now}
onClick={() => steer(x.at)}
>
{clock(x.at)}
</button>
</li>
))}
</ol>
</div>
</div>
</section>
);
}
/* ------------------------------------------------------------------ */
const ROOMS = [
{
name: "Sea room",
size: "24 m²",
sleeps: "Sleeps 2",
price: 180,
img: IMG.room,
tone: "#d9c9ae",
alt: "Sea room with blue shutters",
},
{
name: "Garden room",
size: "28 m²",
sleeps: "Sleeps 2 + a child",
price: 210,
img: IMG.breakfast,
tone: "#c99a64",
alt: "The terrace outside the garden room",
},
{
name: "Tower suite",
size: "46 m²",
sleeps: "Sleeps 4",
price: 340,
img: IMG.basin,
tone: "#a7988a",
alt: "The suite's stone basin",
},
];
function Rooms() {
const [hover, setHover] = useState<number | null>(null);
const float = useRef<HTMLDivElement>(null);
return (
<section className="gu-alba__rooms" aria-labelledby="alba-rooms-title">
<h2 id="alba-rooms-title" className="gu-alba__h2">
Seven rooms, three kinds.
</h2>
<div
className="gu-alba__room-wrap"
onPointerMove={(e) => {
const el = float.current;
if (!el || e.pointerType !== "mouse") return;
const r = e.currentTarget.getBoundingClientRect();
el.style.translate = `${e.clientX - r.left}px ${e.clientY - r.top}px`;
}}
onPointerLeave={() => setHover(null)}
>
<ul className="gu-alba__room-list">
{ROOMS.map((r, i) => (
<li
key={r.name}
onPointerEnter={(e) => e.pointerType === "mouse" && setHover(i)}
>
<Photo
src={r.img}
alt={r.alt}
tone={r.tone}
className="gu-alba__room-thumb"
/>
<h3>{r.name}</h3>
<p>
{r.size}, {r.sleeps.toLowerCase()}
</p>
<p className="gu-alba__room-price">
from <strong>€{r.price}</strong> a night
</p>
</li>
))}
</ul>
<div
ref={float}
className="gu-alba__float"
data-on={hover !== null}
aria-hidden="true"
>
{ROOMS.map((r, i) => (
<div key={r.name} data-on={hover === i}>
<Photo src={r.img} alt="" tone={r.tone} />
</div>
))}
</div>
</div>
</section>
);
}
/* ------------------------------------------------------------------ */
const NIGHT_RATE = 180;
const fmt = new Intl.DateTimeFormat("en-GB", {
weekday: "short",
day: "numeric",
});
const fmtLong = new Intl.DateTimeFormat("en-GB", {
day: "numeric",
month: "short",
});
function Booking({
onRequest,
}: {
onRequest?: (stay: { from: Date; to: Date; guests: number }) => void;
}) {
const [start, setStart] = useState<Date | null>(null);
const [inDay, setIn] = useState<number | null>(null);
const [outDay, setOut] = useState<number | null>(null);
const [guests, setGuests] = useState(2);
const [sent, setSent] = useState(false);
// Dates depend on today, so they're made in the browser only.
useEffect(() => {
const d = new Date();
d.setHours(0, 0, 0, 0);
d.setDate(d.getDate() + 3);
const id = requestAnimationFrame(() => setStart(d));
return () => cancelAnimationFrame(id);
}, []);
const day = (i: number) => {
const d = new Date(start ?? 0);
d.setDate(d.getDate() + i);
return d;
};
const pick = (i: number) => {
if (inDay === null || outDay !== null || i <= inDay) {
setIn(i);
setOut(null);
} else setOut(i);
};
const nights = inDay !== null && outDay !== null ? outDay - inDay : 0;
if (sent && inDay !== null && outDay !== null)
return (
<div className="gu-alba__book is-sent" role="status">
<p className="gu-alba__h3">Request sent.</p>
<p>
{nights} nights for {guests}, {fmtLong.format(day(inDay))} to{" "}
{fmtLong.format(day(outDay))}. We'll write within a day to
confirm.
</p>
<button
type="button"
className="gu-alba__link"
onClick={() => setSent(false)}
>
Change dates
</button>
</div>
);
return (
<form
className="gu-alba__book"
onSubmit={(e) => {
e.preventDefault();
if (!nights || inDay === null || outDay === null) return;
setSent(true);
onRequest?.({ from: day(inDay), to: day(outDay), guests });
}}
>
<div className="gu-alba__book-row">
<p className="gu-alba__h3">
{inDay === null
? "Choose your first night"
: outDay === null
? "Now choose your last morning"
: `${nights} nights`}
</p>
<div className="gu-alba__guests" role="group" aria-label="Guests">
<button
type="button"
aria-label="Fewer guests"
onClick={() => setGuests((g) => Math.max(1, g - 1))}
>
−
</button>
<output aria-live="polite">{guests} guests</output>
<button
type="button"
aria-label="More guests"
onClick={() => setGuests((g) => Math.min(4, g + 1))}
>
+
</button>
</div>
</div>
<div className="gu-alba__strip" role="group" aria-label="Dates">
{start &&
Array.from({ length: 14 }, (_, i) => {
const d = day(i);
const edge = i === inDay || i === outDay;
const inside =
inDay !== null && outDay !== null && i > inDay && i < outDay;
return (
<button
key={i}
type="button"
aria-pressed={edge || inside}
data-edge={edge}
data-inside={inside}
onClick={() => pick(i)}
style={{ "--i": i } as CSSProperties}
>
<span>{fmt.format(d).split(" ")[0]}</span>
<strong>{d.getDate()}</strong>
</button>
);
})}
</div>
<div className="gu-alba__book-row">
<p className="gu-alba__total">
{nights ? (
<>
<strong>€{nights * NIGHT_RATE}</strong> for {nights} nights,
breakfast included
</>
) : (
<>Sea rooms from €{NIGHT_RATE} a night, breakfast included</>
)}
</p>
<button type="submit" className="gu-alba__cta" disabled={!nights}>
{nights ? "Request these dates" : "Pick your dates"}
</button>
</div>
</form>
);
}
/* ------------------------------------------------------------------ */
export function HotelPage({
onRequest,
}: {
onRequest?: (stay: { from: Date; to: Date; guests: number }) => void;
}) {
return (
<div className="gu-alba">
<header className="gu-alba__hero">
<Photo
src={IMG.room}
alt="A limewashed room with faded blue shutters open onto a calm sea"
tone="#d9c9ae"
className="gu-alba__hero-photo"
eager
/>
<nav className="gu-alba__nav" aria-label="Main">
<a href="#" className="gu-alba__logo">
Casa Alba
</a>
<a href="#alba-book" className="gu-alba__pill">
Book a room
</a>
</nav>
<div className="gu-alba__hero-copy">
<p>A small hotel on the southern cliffs</p>
<h1 className="gu-alba__h1">Seven rooms above the sea.</h1>
</div>
</header>
<section className="gu-alba__intro">
<p>
A farmhouse of thick white walls, rebuilt slowly over ten years. No
TV, no lobby music, no buffet. Just shutters, the sea and very good
bread.
</p>
</section>
<DayHere />
<Rooms />
<section
className="gu-alba__booking"
id="alba-book"
aria-labelledby="alba-book-title"
>
<h2 id="alba-book-title" className="gu-alba__h2">
Come and stay.
</h2>
<Booking onRequest={onRequest} />
</section>
<footer className="gu-alba__foot">
<p className="gu-alba__logo">Casa Alba</p>
<p>Open from April to October. Two nights minimum in summer.</p>
</footer>
</div>
);
}
```
### hotel-page.css
```css
/* Casa Alba: limewash white, pale stone, sea blue. The sky section re-lights itself. */
.gu-alba {
--bg: #f6f2ea;
--stone: #e9e1d3;
--ink: #1f2226;
--muted: #6a6560;
--line: rgb(31 34 38 / 0.14);
--sea: #2f5f86;
--accent: #ff5a1f;
--focus: #2b35ff;
--serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
--ease: cubic-bezier(0.22, 1, 0.36, 1);
container-type: inline-size;
background: var(--bg);
color: var(--ink);
font-family:
system-ui,
-apple-system,
"Segoe UI",
sans-serif;
line-height: 1.55;
}
.gu-alba *,
.gu-alba *::before,
.gu-alba *::after {
box-sizing: border-box;
}
.gu-alba a {
color: inherit;
}
.gu-alba :focus-visible {
outline: 3px solid var(--focus);
outline-offset: 3px;
}
.gu-alba__h1,
.gu-alba__h2,
.gu-alba__h3 {
margin: 0;
font-family: var(--serif);
font-weight: 500;
letter-spacing: -0.02em;
text-wrap: balance;
}
.gu-alba__h2 {
font-size: clamp(2.2rem, 5.4cqi, 4.2rem);
line-height: 1;
}
.gu-alba__h3 {
font-size: 1.6rem;
line-height: 1.15;
}
.gu-alba__cta {
min-height: 52px;
padding: 0 26px;
border: 0;
border-radius: 999px;
background: var(--ink);
color: var(--bg);
font: inherit;
font-weight: 700;
cursor: pointer;
transition:
background-color 0.3s,
transform 0.3s var(--ease),
opacity 0.3s;
}
.gu-alba__cta:hover:not(:disabled) {
background: var(--sea);
transform: translateY(-2px);
}
.gu-alba__cta:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.gu-alba__link {
padding: 10px 0;
border: 0;
background: none;
color: inherit;
font: inherit;
font-weight: 700;
text-decoration: underline;
text-underline-offset: 5px;
cursor: pointer;
}
/* ---------- Photos ---------- */
.gu-alba__photo {
position: relative;
overflow: hidden;
background:
radial-gradient(
70% 60% at 30% 30%,
color-mix(in srgb, var(--tone) 50%, #fff),
transparent 70%
),
linear-gradient(
170deg,
var(--tone),
color-mix(in srgb, var(--tone) 75%, #000)
);
}
.gu-alba__photo img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
/* ---------- Hero ---------- */
.gu-alba__hero {
position: relative;
display: flex;
flex-direction: column;
min-height: 700px;
padding: 22px 5% 56px;
color: #fbf8f2;
isolation: isolate;
overflow: hidden;
}
.gu-alba__hero-photo {
position: absolute;
inset: 0;
z-index: -1;
}
.gu-alba__hero-photo img {
animation: gu-alba-breathe 18s ease-in-out infinite alternate;
}
@keyframes gu-alba-breathe {
from {
transform: scale(1.06) translateX(-1%);
}
to {
transform: scale(1.12) translateX(1%);
}
}
.gu-alba__hero-photo::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(
180deg,
rgb(20 22 26 / 0.35),
transparent 25%,
transparent 50%,
rgb(20 22 26 / 0.6)
);
}
.gu-alba__nav {
display: flex;
align-items: center;
justify-content: space-between;
}
.gu-alba__logo {
margin: 0;
font-family: var(--serif);
font-size: 1.5rem;
font-variant: small-caps;
letter-spacing: 0.06em;
text-decoration: none;
}
.gu-alba .gu-alba__pill {
display: inline-flex;
align-items: center;
min-height: 44px;
padding: 0 20px;
border-radius: 999px;
background: #fbf8f2;
color: var(--ink);
font-weight: 700;
text-decoration: none;
transition: transform 0.3s var(--ease);
}
.gu-alba__pill:hover {
transform: translateY(-2px);
}
.gu-alba__hero-copy {
margin-top: auto;
}
.gu-alba__hero-copy p {
margin: 0 0 12px;
font-weight: 600;
animation: gu-alba-rise 1s var(--ease) 0.2s both;
}
.gu-alba__h1 {
max-width: 11ch;
font-size: clamp(3rem, 9cqi, 8rem);
line-height: 0.92;
animation: gu-alba-rise 1.1s var(--ease) 0.35s both;
}
@keyframes gu-alba-rise {
from {
opacity: 0;
transform: translateY(30px);
filter: blur(6px);
}
}
.gu-alba__intro {
padding: 96px 5%;
}
.gu-alba__intro p {
max-width: 30ch;
margin: 0 auto;
font-family: var(--serif);
font-size: clamp(1.6rem, 3.4cqi, 2.6rem);
line-height: 1.2;
text-align: center;
}
/* ---------- A day here ---------- */
.gu-alba__day {
padding: 88px 5% 96px;
background: linear-gradient(180deg, var(--top), var(--bottom));
color: var(--ink);
}
.gu-alba__day-head {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 16px;
}
.gu-alba__clock {
margin: 0;
font-family: var(--serif);
font-size: clamp(2.2rem, 5.4cqi, 4.2rem);
font-variant-numeric: tabular-nums;
line-height: 1;
opacity: 0.85;
}
.gu-alba__day-grid {
display: grid;
gap: 40px;
margin-top: 40px;
}
@container (min-width: 900px) {
.gu-alba__day-grid {
grid-template-columns: 1.15fr 0.85fr;
align-items: center;
gap: 56px;
}
}
.gu-alba__sky {
position: relative;
}
.gu-alba__arc {
display: block;
width: 100%;
overflow: visible;
touch-action: none;
cursor: grab;
user-select: none;
}
.gu-alba__arc:active {
cursor: grabbing;
}
.gu-alba__path {
fill: none;
stroke: currentColor;
stroke-opacity: 0.2;
stroke-width: 2;
stroke-dasharray: 2 8;
stroke-linecap: round;
}
.gu-alba__path-done {
fill: none;
stroke: currentColor;
stroke-opacity: 0.55;
stroke-width: 2;
}
.gu-alba__tick {
fill: currentColor;
opacity: 0.35;
}
.gu-alba__horizon {
stroke: currentColor;
stroke-opacity: 0.25;
}
.gu-alba__sun {
cursor: grab;
outline: none;
}
.gu-alba__sun-glow {
fill: #ffd29a;
opacity: 0.45;
filter: blur(10px);
transform-origin: center;
animation: gu-alba-glow 3s ease-in-out infinite;
}
@keyframes gu-alba-glow {
50% {
opacity: 0.75;
transform: scale(1.15);
}
}
.gu-alba__sun-body {
fill: #ffb05e;
transition: fill 0.8s;
}
.gu-alba__moon-bite {
fill: var(--top);
opacity: 0;
transition: opacity 0.8s;
}
.gu-alba__day[data-night="true"] .gu-alba__sun-body {
fill: #f2ead8;
}
.gu-alba__day[data-night="true"] .gu-alba__sun-glow {
fill: #c9d1ff;
}
.gu-alba__day[data-night="true"] .gu-alba__moon-bite {
opacity: 1;
}
.gu-alba__sun:focus-visible .gu-alba__sun-body {
stroke: var(--focus);
stroke-width: 4;
}
.gu-alba__hint {
position: absolute;
left: 0;
bottom: -4px;
margin: 0;
font-size: 0.85rem;
font-weight: 600;
opacity: 0.6;
}
.gu-alba__frames {
position: relative;
aspect-ratio: 4 / 3;
border-radius: 24px;
overflow: hidden;
box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.45);
}
.gu-alba__frame {
position: absolute;
inset: 0;
opacity: 0;
transform: scale(1.06);
transition:
opacity 0.9s var(--ease),
transform 1.6s var(--ease);
}
.gu-alba__frame[data-on="true"] {
opacity: 1;
transform: none;
}
.gu-alba__frame .gu-alba__photo {
position: absolute;
inset: 0;
}
.gu-alba__moment-text {
margin-top: 20px;
animation: gu-alba-rise 0.7s var(--ease) both;
}
.gu-alba__moment-text h3 {
margin: 2px 0 6px;
font-family: var(--serif);
font-size: 1.8rem;
font-weight: 500;
}
.gu-alba__moment-text p {
margin: 0;
max-width: 40ch;
opacity: 0.8;
}
.gu-alba__time {
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.gu-alba__times {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 20px 0 0;
padding: 0;
list-style: none;
}
.gu-alba__times button {
min-height: 40px;
padding: 0 14px;
border: 1px solid currentColor;
border-radius: 999px;
background: none;
color: inherit;
font: inherit;
font-size: 0.9rem;
font-weight: 700;
font-variant-numeric: tabular-nums;
opacity: 0.55;
cursor: pointer;
transition:
opacity 0.3s,
background-color 0.3s,
color 0.3s;
}
.gu-alba__times button:hover {
opacity: 1;
}
.gu-alba__times button[aria-pressed="true"] {
opacity: 1;
background: var(--ink);
color: var(--top);
border-color: var(--ink);
}
/* ---------- Rooms ---------- */
.gu-alba__rooms {
padding: 96px 5%;
}
.gu-alba__room-wrap {
position: relative;
margin-top: 40px;
}
.gu-alba__room-list {
margin: 0;
padding: 0;
list-style: none;
border-top: 1px solid var(--line);
}
.gu-alba__room-list li {
display: grid;
grid-template-columns: 1fr auto;
align-items: baseline;
gap: 4px 24px;
padding: 28px 0;
border-bottom: 1px solid var(--line);
transition:
padding 0.5s var(--ease),
opacity 0.4s;
}
.gu-alba__room-list li h3 {
margin: 0;
font-family: var(--serif);
font-size: clamp(1.8rem, 4.4cqi, 3.4rem);
font-weight: 500;
line-height: 1.05;
}
.gu-alba__room-list li p {
margin: 0;
color: var(--muted);
}
.gu-alba__room-list li .gu-alba__room-price {
grid-row: 1;
grid-column: 2;
color: var(--ink);
}
.gu-alba__room-price strong {
font-family: var(--serif);
font-size: 1.5rem;
font-weight: 600;
}
.gu-alba__room-thumb {
grid-column: 1 / -1;
aspect-ratio: 16 / 9;
border-radius: 18px;
margin-bottom: 14px;
}
@media (hover: hover) {
.gu-alba__room-thumb {
display: none;
}
.gu-alba__room-wrap:hover li {
opacity: 0.45;
}
.gu-alba__room-wrap li:hover {
opacity: 1;
padding-left: 24px;
}
}
.gu-alba__float {
position: absolute;
top: 0;
left: 0;
width: 280px;
aspect-ratio: 4 / 5;
margin: -175px 0 0 -140px;
pointer-events: none;
border-radius: 20px;
overflow: hidden;
opacity: 0;
scale: 0.6;
rotate: -6deg;
transition:
opacity 0.4s var(--ease),
scale 0.5s var(--ease),
rotate 0.6s var(--ease),
translate 0.35s var(--ease);
box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.4);
}
.gu-alba__float[data-on="true"] {
opacity: 1;
scale: 1;
rotate: 3deg;
}
.gu-alba__float > div {
position: absolute;
inset: 0;
clip-path: inset(100% 0 0 0);
transition: clip-path 0.6s var(--ease);
}
.gu-alba__float > div[data-on="true"] {
clip-path: inset(0);
}
.gu-alba__float .gu-alba__photo {
position: absolute;
inset: 0;
}
@media (hover: none) {
.gu-alba__float {
display: none;
}
}
/* ---------- Booking ---------- */
.gu-alba__booking {
display: grid;
gap: 32px;
padding: 96px 5%;
background: var(--stone);
}
.gu-alba__book {
display: grid;
gap: 24px;
padding: clamp(20px, 3cqi, 36px);
border-radius: 28px;
background: var(--bg);
}
.gu-alba__book.is-sent {
border: 2px solid var(--sea);
animation: gu-alba-rise 0.6s var(--ease) both;
}
.gu-alba__book-row {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.gu-alba__guests {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 4px;
border: 1px solid var(--line);
border-radius: 999px;
}
.gu-alba__guests button {
width: 44px;
height: 44px;
border: 0;
border-radius: 50%;
background: var(--stone);
color: inherit;
font: inherit;
font-size: 1.3rem;
cursor: pointer;
}
.gu-alba__guests output {
min-width: 80px;
text-align: center;
font-weight: 700;
}
.gu-alba__strip {
display: grid;
grid-template-columns: repeat(7, 1fr);
gap: 6px;
}
.gu-alba__strip button {
display: grid;
place-items: center;
gap: 2px;
min-height: 64px;
border: 1px solid var(--line);
border-radius: 16px;
background: none;
color: inherit;
font: inherit;
cursor: pointer;
animation: gu-alba-rise 0.6s var(--ease) both;
animation-delay: calc(var(--i) * 30ms);
transition:
background-color 0.3s,
color 0.3s,
border-color 0.3s,
border-radius 0.3s;
}
.gu-alba__strip button span {
font-size: 0.75rem;
opacity: 0.7;
}
.gu-alba__strip button strong {
font-family: var(--serif);
font-size: 1.35rem;
font-weight: 600;
}
.gu-alba__strip button:hover {
border-color: var(--ink);
}
.gu-alba__strip button[data-inside="true"] {
background: color-mix(in srgb, var(--sea) 16%, var(--bg));
border-color: transparent;
}
.gu-alba__strip button[data-edge="true"] {
background: var(--sea);
color: #fff;
border-color: var(--sea);
}
.gu-alba__total {
margin: 0;
color: var(--muted);
}
.gu-alba__total strong {
color: var(--ink);
font-family: var(--serif);
font-size: 2rem;
font-weight: 600;
}
@container (min-width: 900px) {
.gu-alba__booking {
grid-template-columns: 0.6fr 1.4fr;
align-items: start;
}
}
.gu-alba__foot {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 16px;
padding: 40px 5%;
color: var(--muted);
}
.gu-alba__foot .gu-alba__logo {
color: var(--ink);
}
@media (prefers-reduced-motion: reduce) {
.gu-alba *,
.gu-alba *::before,
.gu-alba *::after {
animation: none !important;
transition: none !important;
}
}
```
You might also want
Next piece: Ceramicist portfolio with a pottery wheelRestaurant page with booking
Landing pages, advanced
Dental clinic landing page with a treatment finder
Landing pages, advanced
Design studio page
Landing pages, advanced



