* { box-sizing: border-box; }
html { color-scheme: light; background: #a4a9c4; }
body { margin: 0; }
html.cycling { scrollbar-width: none; overscroll-behavior-y: none; }
html.cycling::-webkit-scrollbar { display: none; }
.cycling body { height: var(--scroll-track); }
.cycling main { position: fixed; inset: 0; }
main {
  --card-width: min(332px, 72vw, 54svh);
  min-height: 100svh; display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.coast {
  position: absolute; pointer-events: none;
  /* Match the shore at row 522 in the backdrop to row 578 in the framed print. */
  left: 50%; top: calc(50% + (var(--card-width) * 1024 / 720 - 6px) * 66 / 1024);
  width: max(100%, 166svh); aspect-ratio: 1536 / 1024;
  transform: translate(-50%, -50.9765625%);
  background: linear-gradient(180deg, #e1dfea24, #f1e7eb25 58%, #8c9bb80a),
    #a4a9c4 url("coastal-mist.webp") center / cover no-repeat;
}
.daylight {
  position: absolute; inset: 0; opacity: 0; will-change: opacity;
  background-size: 100% 100%; background-repeat: no-repeat;
}
/* The same coastline under each wash keeps even the smallest islands in register. */
.noon {
  background-image: url("coastal-mist.webp"),
    linear-gradient(#5692b7, #8dc2d8 34%, #c6e4e5 51%, #7db4c0 66%, #397c93);
  background-blend-mode: luminosity;
  filter: contrast(1.14) brightness(1.09);
}
.dusk {
  background-image: radial-gradient(ellipse 23% 16% at 73% 48%, #ffbe80a8, transparent),
    linear-gradient(#665b89, #be888d 30%, #f1a077 46%, #ffc38d 51%, #b58085 59%, #675e7f 80%, #384b64),
    url("coastal-mist.webp");
  background-blend-mode: screen, hard-light, normal;
}
.dusk::after {
  content: ""; position: absolute; left: 73%; top: 48.3%;
  width: .85%; aspect-ratio: 1; border-radius: 50%;
  background: #ffdbad; box-shadow: 0 0 15px 4px #ffd0a073;
}
.night {
  background-image: linear-gradient(#17263c, #263d59 22%, #45637d 41%, #91a8b4 51%, #507181 61%, #233e56 80%, #12283d),
    url("coastal-mist.webp");
  background-blend-mode: multiply;
}
.night canvas { width: 100%; height: 100%; display: block; }
.sundial {
  position: absolute; left: 6.3%; bottom: 4.1%; width: clamp(57px, 22%, 80px);
}
.sundial canvas { display: block; width: 100%; height: auto; }
.noon, .print .noon-print { opacity: var(--noon, 0); }
.dusk, .print .dusk-print { opacity: var(--dusk, 0); }
.night, .print .night-print { opacity: var(--night, 0); }
.mount {
  margin: 0; position: relative; perspective: 1000px; touch-action: pan-y pinch-zoom;
  width: var(--card-width); aspect-ratio: 720 / 1024;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.card {
  position: absolute; inset: 0; padding: 3px; border-radius: 15px;
  background: linear-gradient(132deg, #f4f6f4, #b7c8d4 28%, #677c92 58%, #d2d2df 83%, #f1f1e8);
  box-shadow: 0 2px 3px #16294552, 1px 8px 12px -5px #12223c55, 7px 22px 32px -13px #14284249;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); pointer-events: none;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: #223c53; opacity: var(--nightfall, 0); pointer-events: none;
}
.print { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 12px; background: #142b46; }
.print > canvas { position: absolute; width: 100%; height: 100%; inset: 0; }
.signature {
  position: absolute; right: 7.4%; bottom: 4.4%; color: #edf0e9;
  font: 500 14px/1 Menlo, Consolas, monospace; letter-spacing: .04em;
  text-shadow: 0 1px 3px #142d43;
}
.zero { position: relative; display: inline-block; font-family: Arial, sans-serif; }
.zero::after {
  content: ""; position: absolute; width: 1px; height: .54em;
  background: currentColor; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(30deg);
}
.mount:focus-visible { outline: 2px solid #697e93; outline-offset: 9px; border-radius: 15px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.no-script {
  position: absolute; inset: 0; margin: 0; padding: 24px;
  display: grid; place-items: center; text-align: center;
  color: #edf0e9; font: 500 14px/1.7 system-ui, sans-serif;
}
@media (prefers-reduced-motion: reduce) { .card { transform: none; } }

html.showing-result { overflow: hidden; }
.day-result:not([hidden]) {
  position: fixed; inset: 0; z-index: 2; overflow: hidden; isolation: isolate;
  display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(ellipse at center, #392444e8, #16142ef5 70%);
  animation: result-curtain 3.8s both;
}
/* A striped setting sun behind a pair of offset foil impressions. */
.day-result::before {
  content: ""; position: absolute; z-index: -1; border-radius: 50%;
  width: min(72vw, 62svh); aspect-ratio: 1;
  background: linear-gradient(#ffce55, #ff5464 60%, #c93272);
  -webkit-mask-image: repeating-linear-gradient(#000 0 8px, transparent 8px 10px);
  mask-image: repeating-linear-gradient(#000 0 8px, transparent 8px 10px);
  animation: result-sun .65s cubic-bezier(.2,.85,.3,1) both;
}
.result-print {
  width: max-content; max-width: 96vw; display: grid; justify-items: center;
  transform: rotate(-4deg); color: #fff6dd;
  font: italic 1000 min(9vw, 15svh, 132px)/1 system-ui, sans-serif;
  letter-spacing: -.035em; word-spacing: .045em; white-space: nowrap;
}
.result-print strong {
  display: block; position: relative; font-weight: inherit;
  padding: .06em .23em .13em .17em;
  background: #211831; border-block: .025em solid currentColor;
  text-shadow: .025em .035em #bf3268;
  box-shadow: .055em .07em #ed536b;
  animation: result-strike .48s cubic-bezier(.18,.9,.32,1.12) both;
}
.result-print strong:first-child {
  --entry: -90vw; justify-self: start; margin-left: .38em;
  font-size: .72em; color: #ffdb67; z-index: 1;
}
.result-print strong:last-child { --entry: 90vw; animation-delay: .12s; }
@keyframes result-curtain {
  0% { opacity: 0; }
  5%, 75% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes result-strike {
  from { transform: translateX(var(--entry)) skewX(-14deg); }
  to { transform: none; }
}
@keyframes result-sun {
  from { transform: scale(.6); }
  to { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .day-result::before, .result-print strong { animation: none; }
  .result-print { transform: none; }
}
