sky.tsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. "use client";
  2. import { useTheme } from "next-themes";
  3. import { type CSSProperties, useEffect, useId, useState } from "react";
  4. import {
  5. FOOTHILLS,
  6. RAINIER,
  7. RAINIER_SNOW,
  8. SEATTLE_HILLS,
  9. SKYLINE_SIZE,
  10. } from "./rainier-skyline";
  11. import { switchTheme } from "@/lib/theme-transition";
  12. import { cn } from "@/lib/utils";
  13. type Phase = "night" | "dawn" | "day" | "dusk";
  14. const TZ = "America/Los_Angeles";
  15. const SYNODIC_DAYS = 29.530588853;
  16. /** A known new moon, 2000-01-06 18:14 UTC. */
  17. const NEW_MOON = Date.UTC(2000, 0, 6, 18, 14);
  18. const MOON_NAMES = [
  19. "New moon",
  20. "Waxing crescent",
  21. "First quarter",
  22. "Waxing gibbous",
  23. "Full moon",
  24. "Waning gibbous",
  25. "Last quarter",
  26. "Waning crescent",
  27. ];
  28. /** Sky, horizon glow, and landscape colors for each part of the day. */
  29. const PALETTE: Record<
  30. Phase,
  31. {
  32. sky: string;
  33. glow: string;
  34. far: string;
  35. snow: string;
  36. snowShade: string;
  37. mid: string;
  38. near: string;
  39. }
  40. > = {
  41. night: {
  42. sky: "linear-gradient(180deg,#050b1f 0%,#0b1736 46%,#172a52 80%,#22365e 100%)",
  43. glow: "rgb(255 176 128 / 0.16)",
  44. far: "#2b3b60",
  45. snow: "#d5dff1",
  46. snowShade: "#8fa2c6",
  47. mid: "#17223e",
  48. near: "#0a1022",
  49. },
  50. dawn: {
  51. sky: "linear-gradient(180deg,#27356b 0%,#6a5a92 38%,#d48aa0 70%,#ffc39b 100%)",
  52. glow: "rgb(255 214 170 / 0.5)",
  53. far: "#6f5f88",
  54. snow: "#ffdcd2",
  55. snowShade: "#df9fa5",
  56. mid: "#3d3259",
  57. near: "#1f1931",
  58. },
  59. day: {
  60. sky: "linear-gradient(180deg,#2f80d6 0%,#5ea5ec 45%,#9fcdf6 82%,#d6ecfd 100%)",
  61. glow: "rgb(255 255 255 / 0.35)",
  62. far: "#86a2c6",
  63. snow: "#ffffff",
  64. snowShade: "#cfdbec",
  65. mid: "#5d7ca3",
  66. near: "#3a5476",
  67. },
  68. dusk: {
  69. sky: "linear-gradient(180deg,#1b2457 0%,#5b3f80 40%,#c45f80 72%,#ff9b63 100%)",
  70. glow: "rgb(255 170 110 / 0.45)",
  71. far: "#5e4b75",
  72. snow: "#ffc6b4",
  73. snowShade: "#d68b93",
  74. mid: "#352a52",
  75. near: "#1a1630",
  76. },
  77. };
  78. /** The last hour or so of daylight, when the light turns warm. */
  79. const GOLDEN: (typeof PALETTE)["day"] = {
  80. sky: "linear-gradient(180deg,#3a78c6 0%,#78a7dc 42%,#e6c09a 84%,#ffd2a0 100%)",
  81. glow: "rgb(255 200 140 / 0.5)",
  82. far: "#8b92b4",
  83. snow: "#fff1de",
  84. snowShade: "#e0c2b2",
  85. mid: "#5f6e98",
  86. near: "#3b496f",
  87. };
  88. // Integer LCG so the star field is identical on the server and in every browser.
  89. let seed = 11;
  90. const rand = () => ((seed = (seed * 16807) % 2147483647) - 1) / 2147483646;
  91. const STARS = Array.from({ length: 30 }, () => {
  92. const size = rand();
  93. return {
  94. x: (rand() * 100).toFixed(1),
  95. y: (rand() * 66).toFixed(1),
  96. size: size < 0.12 ? 2 : size < 0.45 ? 1.5 : 1,
  97. opacity: (0.3 + rand() * 0.6).toFixed(2),
  98. twinkle: rand() < 0.3 ? (2.4 + rand() * 3).toFixed(1) : null,
  99. };
  100. });
  101. const GRAIN =
  102. "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E\")";
  103. const clock = (h: number) => {
  104. const minutes = Math.round(h * 60) % (24 * 60);
  105. const hh = Math.floor(minutes / 60);
  106. return `${((hh + 11) % 12) + 1}:${String(minutes % 60).padStart(2, "0")} ${hh >= 12 ? "PM" : "AM"}`;
  107. };
  108. const LAT = 47.6062;
  109. const LON = -122.3321;
  110. const rad = Math.PI / 180;
  111. /** Sunrise, solar noon, and sunset in local hours (NOAA's solar equations, accurate to about a minute). */
  112. function sunTimes(doy: number, utcOffset: number) {
  113. const g = ((2 * Math.PI) / 365) * (doy - 1);
  114. const eqTime =
  115. 229.18 *
  116. (0.000075 +
  117. 0.001868 * Math.cos(g) -
  118. 0.032077 * Math.sin(g) -
  119. 0.014615 * Math.cos(2 * g) -
  120. 0.040849 * Math.sin(2 * g));
  121. const decl =
  122. 0.006918 -
  123. 0.399912 * Math.cos(g) +
  124. 0.070257 * Math.sin(g) -
  125. 0.006758 * Math.cos(2 * g) +
  126. 0.000907 * Math.sin(2 * g) -
  127. 0.002697 * Math.cos(3 * g) +
  128. 0.00148 * Math.sin(3 * g);
  129. const ha =
  130. Math.acos(
  131. Math.cos(90.833 * rad) / (Math.cos(LAT * rad) * Math.cos(decl)) -
  132. Math.tan(LAT * rad) * Math.tan(decl),
  133. ) / rad;
  134. const local = (minutes: number) => minutes / 60 + utcOffset;
  135. return {
  136. rise: local(720 - 4 * (LON + ha) - eqTime),
  137. noon: local(720 - 4 * LON - eqTime),
  138. set: local(720 - 4 * (LON - ha) - eqTime),
  139. };
  140. }
  141. /** Seattle's sky right now: the sun's real position and the moon's phase and rough place. */
  142. function seattleSky(now: Date) {
  143. const parts = Object.fromEntries(
  144. new Intl.DateTimeFormat("en-US", {
  145. timeZone: TZ,
  146. hour: "numeric",
  147. minute: "2-digit",
  148. hourCycle: "h23",
  149. timeZoneName: "short",
  150. month: "numeric",
  151. day: "numeric",
  152. year: "numeric",
  153. })
  154. .formatToParts(now)
  155. .map((p) => [p.type, p.value]),
  156. );
  157. const hour = Number(parts.hour) + Number(parts.minute) / 60;
  158. const year = Number(parts.year);
  159. const doy =
  160. (Date.UTC(year, Number(parts.month) - 1, Number(parts.day)) -
  161. Date.UTC(year, 0, 0)) /
  162. 864e5;
  163. const { rise, noon, set } = sunTimes(
  164. doy,
  165. parts.timeZoneName === "PDT" ? -7 : -8,
  166. );
  167. let phase: Phase = "night";
  168. if (hour >= rise - 0.6 && hour < rise + 0.7) phase = "dawn";
  169. else if (hour >= rise + 0.7 && hour < set - 0.8) phase = "day";
  170. else if (hour >= set - 0.8 && hour < set + 0.6) phase = "dusk";
  171. // The moon transits about age × 24.8 h after the sun and is up for roughly 12.4 h.
  172. const age =
  173. ((((now.getTime() - NEW_MOON) / 864e5 / SYNODIC_DAYS) % 1) + 1) % 1;
  174. const moon = ((((hour - (noon + age * 24.8 - 6.2)) % 24) + 24) % 24) / 12.4;
  175. let label = MOON_NAMES[Math.round(age * 8) % 8];
  176. if (phase === "dawn") label = hour < rise ? "First light" : "Sunrise";
  177. else if (phase === "dusk") label = hour < set ? "Sunset" : "Blue hour";
  178. else if (phase === "day")
  179. label = hour > set - 1.8 ? "Golden hour" : "Daylight";
  180. const time = new Intl.DateTimeFormat("en-US", {
  181. timeZone: TZ,
  182. hour: "numeric",
  183. minute: "2-digit",
  184. }).format(now);
  185. const sunUp = hour >= rise && hour < set;
  186. return {
  187. phase,
  188. label,
  189. next: sunUp ? `Sunset ${clock(set)}` : `Sunrise ${clock(rise)}`,
  190. time: time.replace(/\s?[AP]M$/, ""),
  191. meridiem: /PM$/.test(time) ? "PM" : "AM",
  192. sun: (hour - rise) / (set - rise),
  193. moon,
  194. age,
  195. };
  196. }
  197. /** Position along the sky's arc, from the left horizon (0) to the right (1). */
  198. const arc = (p: number): CSSProperties => ({
  199. left: `${6 + p * 88}%`,
  200. top: `${78 - Math.sin(Math.PI * Math.min(1, Math.max(0, p))) * 30}%`,
  201. });
  202. /** The moon's lit shape for its age (0 new, 0.5 full), as seen from the northern hemisphere. */
  203. function Moon({
  204. age,
  205. className,
  206. craters,
  207. }: {
  208. age: number;
  209. className?: string;
  210. craters?: boolean;
  211. }) {
  212. const clip = useId().replace(/[^\w-]/g, "");
  213. const k = Math.cos(2 * Math.PI * age);
  214. const waxing = age < 0.5;
  215. const lit = `M0 -10A10 10 0 0 ${waxing ? 1 : 0} 0 10A${(Math.abs(k) * 10).toFixed(2)} 10 0 0 ${
  216. waxing === k > 0 ? 0 : 1
  217. } 0 -10Z`;
  218. return (
  219. <svg aria-hidden className={className} viewBox="-11 -11 22 22">
  220. <circle fill="currentColor" opacity="0.16" r="10" />
  221. <path d={lit} fill="currentColor" />
  222. {craters && (
  223. <>
  224. <clipPath id={clip}>
  225. <path d={lit} />
  226. </clipPath>
  227. <g clipPath={`url(#${clip})`} fill="#5b6478" opacity="0.18">
  228. <circle cx="-3.2" cy="-3.4" r="2.6" />
  229. <circle cx="3.6" cy="1.6" r="1.9" />
  230. <circle cx="-1.2" cy="4.8" r="1.4" />
  231. <circle cx="4.4" cy="-4.6" r="1.1" />
  232. </g>
  233. </>
  234. )}
  235. </svg>
  236. );
  237. }
  238. const DIGITS =
  239. "font-display text-[46px] font-semibold tracking-[-0.025em] tabular-nums sm:text-[58px]";
  240. /**
  241. * Clock digits made of glass, like the iOS 26 Lock Screen: a clear body that
  242. * lets the sky through, a bevel lit from the upper left, and a bright top rim.
  243. */
  244. function GlassTime({ time, meridiem }: { time: string; meridiem: string }) {
  245. const id = useId().replace(/[^\w-]/g, "");
  246. return (
  247. <svg
  248. aria-label={time ? `${time} ${meridiem}` : undefined}
  249. className={cn(
  250. "mt-1 block h-[44px] w-full overflow-visible transition-opacity duration-500 sm:h-[56px]",
  251. time ? "opacity-100" : "opacity-0",
  252. )}
  253. role="img"
  254. >
  255. <defs>
  256. <filter
  257. colorInterpolationFilters="sRGB"
  258. height="170%"
  259. id={id}
  260. width="130%"
  261. x="-15%"
  262. y="-35%"
  263. >
  264. <feFlood floodColor="#fff" floodOpacity="0.16" />
  265. <feComposite in2="SourceAlpha" operator="in" result="body" />
  266. <feGaussianBlur in="SourceAlpha" result="height" stdDeviation="1.5" />
  267. <feSpecularLighting
  268. in="height"
  269. lightingColor="#fff"
  270. result="light"
  271. specularConstant="1.2"
  272. specularExponent="14"
  273. surfaceScale="3.2"
  274. >
  275. <feDistantLight azimuth="225" elevation="40" />
  276. </feSpecularLighting>
  277. <feComposite
  278. in="light"
  279. in2="SourceAlpha"
  280. operator="in"
  281. result="gloss"
  282. />
  283. <feOffset dy="1.2" in="SourceAlpha" result="down" />
  284. <feComposite
  285. in="SourceAlpha"
  286. in2="down"
  287. operator="out"
  288. result="edge"
  289. />
  290. <feFlood floodColor="#fff" floodOpacity="0.9" />
  291. <feComposite in2="edge" operator="in" result="rim" />
  292. <feGaussianBlur in="SourceAlpha" stdDeviation="5" />
  293. <feOffset dy="3" result="drop" />
  294. <feFlood floodColor="#020617" floodOpacity="0.28" />
  295. <feComposite in2="drop" operator="in" />
  296. <feComposite in2="SourceAlpha" operator="out" result="shadow" />
  297. <feMerge>
  298. <feMergeNode in="shadow" />
  299. <feMergeNode in="body" />
  300. <feMergeNode in="gloss" />
  301. <feMergeNode in="rim" />
  302. </feMerge>
  303. </filter>
  304. </defs>
  305. <text
  306. className={DIGITS}
  307. fill="#fff"
  308. filter={`url(#${id})`}
  309. x="0"
  310. y="0.84em"
  311. >
  312. {time}
  313. </text>
  314. {/* An invisible copy of the digits sets the pen position for AM/PM. */}
  315. <text aria-hidden className={DIGITS} x="0" y="0.84em">
  316. <tspan fill="none">{time}</tspan>
  317. <tspan
  318. className="text-[13px] font-semibold tracking-normal"
  319. dx="6"
  320. fill="rgb(255 255 255 / 0.85)"
  321. >
  322. {meridiem}
  323. </tspan>
  324. </text>
  325. </svg>
  326. );
  327. }
  328. function PhaseIcon({ phase, age }: { phase: Phase; age: number }) {
  329. if (phase === "night") return <Moon age={age} className="size-[13px]" />;
  330. if (phase === "day") {
  331. return (
  332. <svg aria-hidden className="size-[13px]" fill="none" viewBox="0 0 16 16">
  333. <circle cx="8" cy="8" fill="currentColor" r="3.2" />
  334. <path
  335. d="M8 1.6v1.5M8 12.9v1.5M1.6 8h1.5M12.9 8h1.5M3.5 3.5l1 1M11.5 11.5l1 1M3.5 12.5l1-1M11.5 4.5l1-1"
  336. stroke="currentColor"
  337. strokeLinecap="round"
  338. strokeWidth="1.4"
  339. />
  340. </svg>
  341. );
  342. }
  343. return (
  344. <svg aria-hidden className="size-[13px]" fill="none" viewBox="0 0 16 16">
  345. <path d="M4.4 11.6a3.6 3.6 0 0 1 7.2 0Z" fill="currentColor" />
  346. <path
  347. d={
  348. phase === "dawn"
  349. ? "M1.5 11.6h13M8 2v3.6M6.4 3.6 8 2l1.6 1.6"
  350. : "M1.5 11.6h13M8 2v3.6M6.4 4 8 5.6 9.6 4"
  351. }
  352. stroke="currentColor"
  353. strokeLinecap="round"
  354. strokeLinejoin="round"
  355. strokeWidth="1.4"
  356. />
  357. </svg>
  358. );
  359. }
  360. /**
  361. * An Apple Weather-style widget for Seattle's real sky right now: the sun or
  362. * the moon in its actual phase over Mount Rainier's true skyline from Kerry
  363. * Park. It doubles as the light switch for the site.
  364. */
  365. export function SkyCard() {
  366. const { resolvedTheme, setTheme } = useTheme();
  367. const [sky, setSky] = useState<ReturnType<typeof seattleSky> | null>(null);
  368. useEffect(() => {
  369. const tick = () => setSky(seattleSky(new Date()));
  370. tick();
  371. const id = window.setInterval(tick, 20_000);
  372. return () => window.clearInterval(id);
  373. }, []);
  374. const phase = sky?.phase ?? "night";
  375. const colors = sky?.label === "Golden hour" ? GOLDEN : PALETTE[phase];
  376. const [width, height] = SKYLINE_SIZE;
  377. const sunVisible = sky !== null && sky.sun >= -0.02 && sky.sun <= 1.02;
  378. const moonVisible =
  379. sky !== null && sky.moon <= 1 && sky.age > 0.03 && sky.age < 0.97;
  380. return (
  381. <div
  382. className="relative h-full overflow-hidden text-white transition-[background] duration-1000"
  383. style={
  384. {
  385. background: colors.sky,
  386. "--far": colors.far,
  387. "--snow": colors.snow,
  388. "--snow-shade": colors.snowShade,
  389. "--mid": colors.mid,
  390. "--near": colors.near,
  391. } as CSSProperties
  392. }
  393. >
  394. <div
  395. aria-hidden
  396. className="absolute inset-0 transition-[background] duration-1000"
  397. style={{
  398. background: `radial-gradient(85% 42% at 58% 84%, ${colors.glow}, transparent 72%)`,
  399. }}
  400. />
  401. <div
  402. aria-hidden
  403. className={cn(
  404. "absolute inset-0 transition-opacity duration-1000",
  405. phase === "night"
  406. ? "opacity-100"
  407. : phase === "day"
  408. ? "opacity-0"
  409. : "opacity-40",
  410. )}
  411. >
  412. {STARS.map((s, i) => (
  413. <span
  414. key={i}
  415. className="absolute rounded-full bg-white"
  416. style={{
  417. left: `${s.x}%`,
  418. top: `${s.y}%`,
  419. width: s.size,
  420. height: s.size,
  421. opacity: s.opacity,
  422. animation: s.twinkle
  423. ? `twinkle ${s.twinkle}s ease-in-out ${-i * 0.7}s infinite`
  424. : undefined,
  425. }}
  426. />
  427. ))}
  428. </div>
  429. {sky && moonVisible && (
  430. <span
  431. aria-hidden
  432. className={cn(
  433. "absolute -translate-x-1/2 -translate-y-1/2 text-[#f5f1e4] transition-opacity duration-1000 [animation:fade-in_1s_ease_both]",
  434. phase === "day" ? "opacity-50" : "opacity-100",
  435. )}
  436. style={arc(sky.moon)}
  437. >
  438. <span className="absolute -inset-3 rounded-full bg-[radial-gradient(closest-side,rgb(245_241_228/0.3),transparent)]" />
  439. <Moon
  440. craters
  441. age={sky.age}
  442. className="relative block size-[17px] sm:size-5"
  443. />
  444. </span>
  445. )}
  446. {sky && sunVisible && (
  447. <span
  448. aria-hidden
  449. className="absolute size-[18px] -translate-x-1/2 -translate-y-1/2 [animation:fade-in_1s_ease_both] sm:size-[22px]"
  450. style={arc(sky.sun)}
  451. >
  452. <span
  453. className={cn(
  454. "absolute -inset-[180%] rounded-full",
  455. phase === "day"
  456. ? "bg-[radial-gradient(closest-side,rgb(255_236_180/0.5),transparent)]"
  457. : "bg-[radial-gradient(closest-side,rgb(255_170_110/0.6),transparent)]",
  458. )}
  459. />
  460. <span
  461. className={cn(
  462. "absolute inset-0 rounded-full",
  463. phase === "day"
  464. ? "bg-[radial-gradient(circle,#fffef8_45%,#fff1c2)] shadow-[0_0_16px_4px_rgb(255_240_200/0.7)]"
  465. : "bg-[radial-gradient(circle,#fff3dc_40%,#ffc58a)] shadow-[0_0_18px_6px_rgb(255_170_110/0.55)]",
  466. )}
  467. />
  468. </span>
  469. )}
  470. <svg
  471. aria-hidden
  472. className="absolute inset-x-0 bottom-0 h-[44%] w-full"
  473. preserveAspectRatio="xMidYMax slice"
  474. viewBox={`${width * 0.29} 0 ${width * 0.56} ${height}`}
  475. >
  476. <defs>
  477. <linearGradient id="rainier-snow" x1="0" x2="0" y1="0" y2="1">
  478. <stop offset="0.2" stopColor="var(--snow)" />
  479. <stop offset="0.85" stopColor="var(--snow-shade)" />
  480. </linearGradient>
  481. </defs>
  482. <path
  483. className="transition-[fill] duration-1000"
  484. d={RAINIER}
  485. fill="var(--far)"
  486. />
  487. <path d={RAINIER_SNOW} fill="url(#rainier-snow)" />
  488. <path
  489. className="transition-[fill] duration-1000"
  490. d={FOOTHILLS}
  491. fill="var(--mid)"
  492. />
  493. <path
  494. className="transition-[fill] duration-1000"
  495. d={SEATTLE_HILLS}
  496. fill="var(--near)"
  497. />
  498. </svg>
  499. <div
  500. aria-hidden
  501. className="absolute inset-0 opacity-25 mix-blend-soft-light"
  502. style={{ backgroundImage: GRAIN }}
  503. />
  504. <div className="relative flex h-full flex-col justify-between p-4 [text-shadow:0_1px_10px_rgb(0_0_0/0.18)] sm:p-5">
  505. <div className="flex items-start justify-between gap-2">
  506. <div className="min-w-0 flex-1 leading-none">
  507. <p className="flex items-center gap-1 text-[15px] font-semibold">
  508. Seattle
  509. <svg
  510. aria-hidden
  511. className="size-[10px] opacity-90"
  512. viewBox="0 0 16 16"
  513. >
  514. <path
  515. d="M14.2 1.8 2.3 6.9c-.6.3-.5 1.1.1 1.2l4.9 1 1 4.9c.1.6.9.7 1.2.1L14.2 1.8Z"
  516. fill="currentColor"
  517. />
  518. </svg>
  519. </p>
  520. <GlassTime meridiem={sky?.meridiem ?? ""} time={sky?.time ?? ""} />
  521. </div>
  522. <button
  523. aria-label="Toggle dark mode"
  524. className="lg grid size-8 shrink-0 place-items-center rounded-full text-white [--glass-ink:#fff] [--glass-tint:rgb(255_255_255/0.14)]"
  525. data-cursor="Lights"
  526. type="button"
  527. onClick={(e) => {
  528. const r = e.currentTarget.getBoundingClientRect();
  529. switchTheme(
  530. resolvedTheme === "dark" ? "light" : "dark",
  531. setTheme,
  532. {
  533. x: r.left + r.width / 2,
  534. y: r.top + r.height / 2,
  535. },
  536. );
  537. }}
  538. >
  539. <span className="lg-caustic" />
  540. <svg aria-hidden className="size-4" fill="none" viewBox="0 0 16 16">
  541. <circle
  542. cx="8"
  543. cy="8"
  544. r="6"
  545. stroke="currentColor"
  546. strokeWidth="1.5"
  547. />
  548. <path d="M8 2a6 6 0 0 1 0 12Z" fill="currentColor" />
  549. </svg>
  550. </button>
  551. </div>
  552. <div
  553. className={cn(
  554. "text-[13px] leading-[1.3] transition-opacity duration-500",
  555. sky ? "opacity-100" : "opacity-0",
  556. )}
  557. >
  558. <p className="flex items-center gap-1.5 font-semibold">
  559. {sky && <PhaseIcon age={sky.age} phase={phase} />}
  560. {sky?.label ?? "Seattle"}
  561. </p>
  562. <p className="opacity-85">{sky?.next ?? "Sunrise"}</p>
  563. </div>
  564. </div>
  565. </div>
  566. );
  567. }