/* ============================================================================
   WatchSky — landing page + the face (the face is also on the home page).
   The watch hardware (.watch, .watch-case, .dial…) and the playground layout
   (.pg-*: the pinned watch, the time slider, the settings cards) come from
   ../style.css. This file keeps what is WatchSky's own.
============================================================================ */

@property --ws-glow {
  syntax: "<color>";
  inherits: true;
  initial-value: #4d7aa8;
}

/* ----------------------------------------------------------------------------
   The face, drawn by watchsky.js into a 450×450 SVG (the watch's own canvas)
---------------------------------------------------------------------------- */
.ws-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Before the script runs (or without it): the face's own preview image */
.ws-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ws-text {
  font-family: var(--font);
  fill: #fff;
  fill-opacity: 0.85;
  text-anchor: middle;
}

.ws-clock {
  font-family: "Inter Tight", var(--font);
  font-size: 97px;
  font-weight: 300;
  fill: #fff;
  text-anchor: middle;
}
.ws-clock-aod { font-weight: 100; opacity: 0; }

.ws-day,
.ws-clock,
.ws-cx,
.ws-bar,
.ws-ground,
.ws-edge { transition: opacity 0.5s var(--ease); }

.is-aod .ws-day,
.is-aod .ws-clock,
.ws-cx.is-hidden,
.ws-bar.is-hidden,
.ws-ground.is-hidden { opacity: 0; }
.is-aod .ws-clock-aod { opacity: 1; }

/* Dark ground: the sky wrapper's scaleY 0.7 about the top edge, so the sky
   ends at the horizon and only its last 45 px spill below the line */
.ws-sky {
  transform-origin: 0 0;
  transition: transform 0.5s var(--ease);
}
.ws-sky.is-squeezed { transform: scaleY(0.7); }

.ws-bar {
  transform-box: fill-box;
  transform-origin: 0 50%;
}
/* The moon's halo screens over the sky (blendMode SCREEN), the sun's glow
   adds to it (blendMode PLUS) */
.ws-screen { mix-blend-mode: screen; }
.ws-plus { mix-blend-mode: plus-lighter; }

/* The glow behind the watch follows the sky */
:where([data-ws-glow], [data-ws-page] .pg-stage) { transition: --ws-glow var(--dur-slower) var(--ease); }
.app-visual[data-ws-glow] { --src-bg: var(--ws-glow); }

/* Morphs between the home page card and this page (the Brief watch has its own) */
.app-visual .watch.ws-watch,
[data-ws-page] .pg-visual .watch { view-transition-name: watchsky-watch; }
.app-title img.ws-mark,
[data-ws-page] .pg-intro .app-badge img { view-transition-name: watchsky-mark; }

/* The glow behind the pinned watch is the sky's (.pg-stage, ../style.css) */
[data-ws-page] .pg-stage { --pg-glow: var(--ws-glow); }

.app-title img.ws-mark { border-radius: 14px; }

/* Dusk in type: gold into rose into night blue */
[data-ws-page] .pg-intro .hl {
  background: linear-gradient(100deg, light-dark(#b45309, #f2c460), light-dark(#be3a5a, #ff8a6b) 45%, light-dark(#4f46a5, #a9b4ff));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Where the browser can, the highlight follows the sky on the watch instead:
   its horizon colour into its zenith colour, ending on the brand periwinkle.
   watchsky.js sets the two sky colours; the lightness is pinned per theme so
   the words stay readable when the sky is nearly black, and only the hue and
   a little of the chroma travel with the day. */
@property --ws-horizon {
  syntax: "<color>";
  inherits: true;
  initial-value: #e5793f;
}
@property --ws-zenith {
  syntax: "<color>";
  inherits: true;
  initial-value: #4e518b;
}

[data-ws-page] { transition: --ws-horizon 1.2s var(--ease), --ws-zenith 1.2s var(--ease); }

@supports (color: oklch(from red l c h)) {
  [data-ws-page] .pg-intro .hl {
    --hl-a: light-dark(
      oklch(from var(--ws-horizon) 0.56 min(calc(c * 1.15 + 0.03), 0.17) h),
      oklch(from var(--ws-horizon) 0.85 min(calc(c * 1.15 + 0.03), 0.16) h));
    --hl-b: light-dark(
      oklch(from var(--ws-zenith) 0.5 min(calc(c * 1.15 + 0.03), 0.17) h),
      oklch(from var(--ws-zenith) 0.8 min(calc(c * 1.15 + 0.03), 0.16) h));
    background-image: linear-gradient(100deg, var(--hl-a), var(--hl-b) 55%, light-dark(#4f46a5, #a9b4ff));
  }
}

/* Weather chips wear their own midday sky */
.pg-chip-face.sky {
  border-color: transparent;
  background: linear-gradient(to bottom, var(--a), var(--b));
  color: #fff;
}
.pg-chip-face.sky img { width: 32px; height: 32px; }
.pg-chip-face .sun {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff5d8;
  box-shadow: 0 0 10px 4px rgb(255 231 176 / 0.55);
}

/* The editor icons' images (.pg-ico, ../style.css): the url() in --i
   resolves against this file, next to img/ */
.pg-ico { -webkit-mask-image: var(--i); mask-image: var(--i); }

/* Latitude: south to north, the track coloured by today's length of day */
.ws-lat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  color: var(--faint);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.ws-lat-note { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.55; }
.ws-lat-note strong { color: var(--text); font-weight: 600; }

/* A moment the sun skips today at this latitude */
.pg-moments .btn:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
