:root{
  /* Clockspian light, the default — js/settings.js overwrites all of these, so they only
     cover the frame before it runs */
  --bg:#eff2f6;
  --line:#cfd6e0;
  --fg:#172030;
  --fg-dim:#626e82;
  --accent:#4a6890;
  --accent-2:#8fa3c0;
  --ui-scale:1;
  /* js/fit.js takes this below 1 on a window too short (or narrow) for the clock */
  --fit:1;
  /* everything sized below runs through this; the slider's 100% is 1.4× the original design */
  --size:calc(var(--ui-scale) * 1.4 * var(--fit));
  --font-stack:'Jost','Helvetica Neue',Arial,sans-serif;
  /* only the Kal theme splits these off from the body face / base weight */
  --font-display:'Jost','Helvetica Neue',Arial,sans-serif;
  --time-weight:200;
  /* Ember's narrow face sets its clock larger and Terminal's wide one smaller and
     condensed, so every theme's clock spans about the same width */
  --time-scale:1;
  --time-stretch:normal;

  --panel-bg:var(--bg);
}

/* Registered so it can transition: the clock glides between sizes instead of jumping.
   The duration and curve match the slider thumb's glide in js/settings.js. */
@property --ui-scale{ syntax:'<number>'; inherits:true; initial-value:1; }
/* --fit too: when the column grows or shrinks (the calendar coming and going), the clock
   squeezes down or springs back instead of jumping. js/fit.js turns it off while the
   window itself is being resized, and on the first frame. */
@property --fit{ syntax:'<number>'; inherits:true; initial-value:1; }

*{margin:0;padding:0;box-sizing:border-box;}
html,body{
  width:100%;height:100%;
  background:var(--bg);
  color:var(--fg);
  font-family:var(--font-stack);
  overflow:hidden;
  transition:background-color 0.4s ease, color 0.4s ease;
}
:root{
  transition:background-color 0.4s ease, color 0.4s ease, --ui-scale 0.2s cubic-bezier(0.33, 1, 0.68, 1), --fit var(--squeeze);
}
/* a little give at the end, so the squeeze settles rather than stops */
:root{ --squeeze:0.7s cubic-bezier(0.34, 1.25, 0.64, 1); }
@media (prefers-reduced-motion:reduce){ :root{ --squeeze:0s; } }
:root.fit-instant{ transition:background-color 0.4s ease, color 0.4s ease, --ui-scale 0.2s cubic-bezier(0.33, 1, 0.68, 1); }

.stage{
  position:relative;
  width:100vw;height:100vh;
  font-variant-numeric:lining-nums; /* the date's figures too, in old-style faces */
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  background:
    radial-gradient(circle at 15% 85%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 55%),
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    var(--bg);
  transition:background 0.4s ease;
}

.center{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:calc(clamp(18px, 3vh, 34px) * var(--size));
  z-index:2;
}

.time{
  font-family:var(--font-display);
  font-size:calc(clamp(72px, 15vw, 190px) * var(--size) * var(--time-scale));
  font-weight:var(--time-weight);
  font-stretch:var(--time-stretch);
  letter-spacing:-0.02em;
  line-height:1;
  /* lining as well as tabular: Moss's Young Serif defaults to old-style figures, which
     rise and drop around the line, so 18:59 would sit on three different baselines */
  font-variant-numeric:tabular-nums lining-nums;
  font-feature-settings:'tnum' 1, 'lnum' 1;
  color:var(--fg);
  /* Its own layer, which turns Windows' ClearType colour fringes into plain grey edges.
     Sub-pixel smoothing sharpens small text; at this size it only shows as cyan and
     orange halos along every hairline. */
  will-change:transform;
}
/* A theme with hairlines too fine for a standard-resolution screen names a sturdier
   optical size for it; see lowResOpsz in js/settings.js. */
@media (max-resolution:1.5dppx){
  .time{ font-variation-settings:var(--time-lowres-variation, normal); }
}
.time .colon{
  display:inline-block;
  color:var(--accent);
  animation:blink 2s steps(1) infinite;
  padding:0 0.02em;
}
@keyframes blink{ 0%,45%{opacity:1;} 50%,95%{opacity:0.15;} 100%{opacity:1;} }

.date-row{
  display:flex;
  align-items:center;
  gap:calc(16px * var(--size));
  font-size:calc(clamp(13px,1.6vw,18px) * var(--size));
  letter-spacing:0.24em;
  text-transform:uppercase;
  color:var(--fg-dim);
}
.date-row .dot{
  width:calc(5px * var(--size));
  height:calc(5px * var(--size));
  border-radius:50%;
  background:var(--accent-2);
}

/* The countdown tucks up under the date as a second line of it, half the usual gap away,
   with the time left in the accent and the display face's tabular figures. */
.countdown{
  display:flex;
  align-items:center;
  gap:calc(12px * var(--size));
  margin-top:calc(clamp(18px, 3vh, 34px) * var(--size) * -0.55);
  font-size:calc(clamp(11px,1.3vw,14px) * var(--size));
  letter-spacing:0.2em;
  /* in em, so it inherits as a fixed length and a bigger "now" can't make the line taller */
  line-height:1.4em;
  text-transform:uppercase;
  color:var(--fg-dim);
}
/* display:flex outranks the UA rule for [hidden] */
.countdown[hidden], .countdown [hidden]{ display:none; }
.countdown .dot{
  width:calc(4px * var(--size));
  height:calc(4px * var(--size));
  border-radius:50%;
  background:var(--accent-2);
}
.countdown-value{
  font-family:var(--font-display);
  font-variant-numeric:tabular-nums lining-nums;
  font-feature-settings:'tnum' 1, 'lnum' 1;
  letter-spacing:0.08em;
  color:var(--accent);
}
/* When the moment arrives, "now" becomes a filled pill that sends out a ripple, so it
   catches the eye from the side of a desk. For the first minute it's a size up and
   ripples faster, then it settles for the rest of the afterglow. It grows by font size,
   not transform, so the line re-centres and the dot stays midway; the fixed line height
   on .countdown and the margin that gives back the padding keep the clock above still. */
.countdown.arrived .countdown-value{
  padding:0.25em 0.72em 0.25em 0.8em;
  margin-block:-0.25em;
  border-radius:999px;
  background:var(--accent);
  color:var(--bg);
  outline:0.12em solid transparent;
  transition:font-size 0.8s cubic-bezier(0.33, 1, 0.68, 1);
  animation:now-ripple 3.2s ease-out infinite;
}
.countdown.arrived.fresh .countdown-value{
  font-size:1.3em;
  animation-duration:1.4s;
}
@keyframes now-ripple{
  0%{ outline-offset:0; outline-color:color-mix(in srgb, var(--accent) 70%, transparent); }
  60%,100%{ outline-offset:0.8em; outline-color:color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* A short hairline, pulled in to half the column's gap on either side, so the weather
   reads as part of the clock's group rather than a second one further down the screen. */
.divider{
  width:1px;
  height:calc(clamp(18px,3vh,36px) * var(--size));
  margin-block:calc(clamp(18px, 3vh, 34px) * var(--size) * -0.5);
  background:linear-gradient(var(--line), transparent);
}

.weather{
  position:relative;
  display:flex;
  align-items:center;
  gap:calc(clamp(20px,3vw,40px) * var(--size));
  transition:opacity 0.6s ease;
}
.weather.stale{ opacity:0.55; }

.glyph{
  width:calc(56px * var(--size));
  height:calc(56px * var(--size));
  flex-shrink:0;
  color:var(--fg-dim);
}
.glyph svg{ width:100%; height:100%; display:block; }

.temp-block{
  display:flex;
  align-items:baseline;
  gap:calc(6px * var(--size));
}
.temp{
  font-family:var(--font-display);
  font-size:calc(clamp(40px,6vw,64px) * var(--size));
  font-weight:300;
  letter-spacing:-0.01em;
  font-variant-numeric:tabular-nums lining-nums;
  font-feature-settings:'tnum' 1, 'lnum' 1;
}
.unit{
  font-size:calc(clamp(18px,2.2vw,26px) * var(--size));
  color:var(--fg-dim);
  font-weight:300;
}

.condition-block{
  display:flex;
  flex-direction:column;
  gap:calc(6px * var(--size));
}
.condition{
  font-size:calc(clamp(14px,1.7vw,19px) * var(--size));
  color:var(--fg);
  letter-spacing:0.02em;
}
.place{
  font-size:calc(clamp(11px,1.3vw,14px) * var(--size));
  letter-spacing:0.2em;
  text-transform:uppercase;
  color:var(--fg-dim);
}

.range{
  display:flex;
  font-family:var(--font-display);
  gap:calc(14px * var(--size));
  font-size:calc(clamp(12px,1.4vw,15px) * var(--size));
  color:var(--fg-dim);
  letter-spacing:0.04em;
  font-variant-numeric:tabular-nums lining-nums;
}
.range .hi{ color:var(--accent); }

/* small dim mark when the reading is a cached fallback */
.stale-dot{
  position:absolute;
  top:50%;
  right:calc(-18px * var(--size));
  width:4px;height:4px;
  margin-top:-2px;
  border-radius:50%;
  background:var(--fg-dim);
  opacity:0;
  transition:opacity 0.6s ease;
}
.weather.stale .stale-dot{ opacity:0.8; }

/* The minute's progress along the bottom edge. A faint full-width rail shows where the
   bar is headed, so even a few seconds in it reads as progress rather than a stray mark.
   It sizes with the clock, and fills in the full accent so it holds its own against the bg. */
.seconds-rail{
  position:absolute;
  bottom:0; left:0; right:0;
  height:calc(4px * var(--size));
  background:color-mix(in srgb, var(--line) 70%, transparent);
  transition:background-color 0.4s ease;
}
.seconds-track{
  height:100%;
  width:0;
  background:var(--accent);
  transition:width 1s linear, background-color 0.4s ease;
}
/* no easing when the bar wraps back to zero at the top of a minute */
.seconds-track.no-transition{ transition:none; }

/* the two seconds settings, switched off */
body.no-blink .time .colon{ animation:none; }
body.no-bar .seconds-rail{ display:none; }
/* Off for the barest look: just the time. A countdown keeps its own line, no longer
   tucked up under a date that isn't there. */
body.no-date .date-row{ display:none; }
body.no-date .countdown{ margin-top:0; }
/* Show weather off: the clock and date re-centre on their own */
body.no-weather .divider,
body.no-weather .weather,
body.no-place .divider,
body.no-place .weather{ display:none; }

/* ---- the calendar ---- */

/* A fold: a grid with one row, folded to nothing (0fr) or open to its content (1fr), so
   its height eases open and shut. js/fit.js counts each at the height it's heading for. */
.fold{
  display:grid;
  grid-template-rows:0fr;
  transition:grid-template-rows var(--squeeze);
}
.fold > *{ min-height:0; overflow:hidden; }

/* Under the date (and countdown), above the weather. Folded, the slot also hands back the
   column's gap with a negative margin, so it takes up no room at all. */
.calendar-slot{
  margin-top:calc(clamp(18px, 3vh, 34px) * var(--size) * -1);
  transition:grid-template-rows var(--squeeze), margin-top var(--squeeze);
}
body.show-calendar .calendar-slot{ grid-template-rows:1fr; margin-top:0; }

/* The strip reads as a second line of the date: the same colour, the same tracking. */
.calendar{
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:0;
  border:0;
  background:none;
  font:inherit;
  font-size:calc(clamp(11px,1.15vw,15px) * var(--size));
  color:var(--fg-dim);
  cursor:pointer;
  opacity:0;
  transform:scale(0.96);
  transition:opacity 0.3s ease, transform var(--squeeze);
  -webkit-tap-highlight-color:transparent;
}
body.show-calendar .calendar{
  opacity:1;
  transform:none;
  transition:opacity 0.45s ease 0.15s, transform var(--squeeze);
}
.calendar:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:8px; border-radius:6px; }
.calendar.expanded .cal-after{ grid-template-rows:1fr; }
.calendar.expanded .cal-before,
.calendar.expanded .cal-heads-fold{ grid-template-rows:1fr; }
/* the earlier weeks open upwards: their fold's content sits at its bottom edge */
/* The weeks: open and at rest, the folds stop clipping and this clips them all as one, at
   its top and bottom, so the spare week either side can scroll in. */
.cal-weeks{ display:flex; flex-direction:column; align-items:center; }
.calendar.settled .cal-weeks{ overflow:clip; }
.calendar.settled .cal-before > .fold-inner,
.calendar.settled .cal-after > .fold-inner{ overflow:visible; }
#calBefore, #calAfter{ position:relative; }
.cal-buffer{ position:absolute; left:0; visibility:hidden; }
.cal-buffer-top{ bottom:100%; }
.cal-buffer-bottom{ top:100%; }
.calendar.settled .cal-buffer{ visibility:visible; }
.cal-before > .fold-inner{ display:flex; flex-direction:column; justify-content:flex-end; }
.fold-inner{ display:flex; flex-direction:column; }

/* Every row: the week number, seven days, and a month's name where one starts. The month
   column is as wide as the week column, so the days sit on the clock's centre line. */
.cal-row{
  display:grid;
  grid-template-columns:repeat(9, 2.3em);
  height:2.3em;
  place-items:center;
  font-family:var(--font-display);
  font-variant-numeric:tabular-nums lining-nums;
  font-feature-settings:'tnum' 1, 'lnum' 1;
}
/* The rows around this week arrive one after another, outwards from it, and leave the
   other way round. */
.cal-heads-fold .cal-row, .cal-before .cal-row, .cal-after .cal-row{
  opacity:0;
  transform:translateY(calc(var(--dir) * -0.6em));
  transition:opacity 0.2s ease, transform 0.2s ease;
}
.cal-heads-fold .cal-row, .cal-before .cal-row{ --dir:-1; }
.cal-after .cal-row{ --dir:1; }
.calendar.expanded .cal-heads-fold .cal-row,
.calendar.expanded .cal-before .cal-row,
.calendar.expanded .cal-after .cal-row{
  opacity:1;
  transform:none;
  transition:
    opacity 0.35s ease calc(var(--distance) * 35ms + 60ms),
    transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) calc(var(--distance) * 35ms + 60ms);
}

.cal-week{
  justify-self:stretch;
  align-self:stretch;
  display:grid;
  place-items:center;
  font-size:0.8em;
  color:var(--accent-2);
  border-right:1px solid var(--line);
}
/* this week's number, in the strip, is the one that matters */
.cal-current.this-week .cal-week{ color:var(--accent); }
.cal-heads .cal-week{ border-right-color:transparent; }
.cal-head{
  font-family:var(--font-stack);
  font-size:0.75em;
  letter-spacing:0.1em;
}
.cal-day{
  width:1.85em; height:1.85em;
  display:grid;
  place-items:center;
  color:var(--fg-dim);
}
.cal-day.past{ opacity:0.4; }
.cal-day.first{ color:var(--fg); }
.cal-day.today{
  border-radius:50%;
  background:var(--accent);
  color:var(--bg);
}
.cal-month{
  justify-self:start;
  padding-left:0.6em;
  font-family:var(--font-stack);
  font-size:0.75em;
  letter-spacing:0.16em;
  text-transform:uppercase;
  color:var(--accent-2);
}

/* A hint that there's more: shown, like the gear, only while the pointer moves, and
   turned over once the weeks are open. */
.cal-chevron{
  width:1.1em; height:1.1em;
  margin-top:0.1em;
  opacity:0;
  transition:opacity 0.5s ease, transform var(--squeeze);
}
body.pointer-active .cal-chevron{ opacity:0.4; }
.calendar:hover .cal-chevron{ opacity:0.8; }
.calendar.expanded .cal-chevron{ transform:rotate(180deg); }

/* ---- the opening ---- */

/* Over everything from the first frame, on the stage's own background, so the clock only
   appears as this fades. It waits, empty, until js/splash.js adds .play. */
.splash{
  position:fixed;
  inset:0;
  z-index:20;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:clamp(24px, 3.2vh, 40px);
  background:
    radial-gradient(circle at 15% 85%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 55%),
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    var(--bg);
}
/* Sized to the screen, like the clock it opens onto: about 120px and 22px on a 1080p
   screen, readable from across the desk, and smaller on a small laptop. */
.splash-mark{ width:clamp(88px, 11vh, 150px); height:clamp(88px, 11vh, 150px); }
.splash-mark path{ stroke-dasharray:1; stroke-dashoffset:1; }
.splash .brand-name{ font-size:clamp(15px, 2vh, 26px); opacity:0; }

/* The dial draws, the hands follow as it closes, the mark settles to full size as it
   goes, the name rises in under it — then a pause, and the lot fades into the clock. */
.splash.play{ animation:splash-out 0.5s ease 1.9s forwards; }
.splash.play .splash-mark{ animation:splash-settle 1.2s cubic-bezier(0.33, 1, 0.68, 1) both; }
.splash.play .brand-dial{ animation:splash-draw 0.85s cubic-bezier(0.65, 0, 0.35, 1) 0.1s forwards; }
.splash.play .brand-hands{ animation:splash-draw 0.5s cubic-bezier(0.65, 0, 0.35, 1) 0.7s forwards; }
.splash.play .brand-name{ animation:splash-rise 0.5s cubic-bezier(0.33, 1, 0.68, 1) 1.05s forwards; }
/* a click or a key: straight to the clock */
.splash.play.skip{ animation:splash-out 0.25s ease forwards; }

@keyframes splash-draw{ to{ stroke-dashoffset:0; } }
@keyframes splash-settle{ from{ transform:scale(0.94); } }
@keyframes splash-rise{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:none; }
}
@keyframes splash-out{ to{ opacity:0; visibility:hidden; } }

/* ---- settings ---- */

.settings-toggle{
  position:absolute;
  top:30px; right:30px;
  z-index:6;
  width:20px; height:20px;
  padding:0;
  color:var(--fg-dim);
  background:none;
  border:none;
  cursor:pointer;
  opacity:0;
  transition:opacity 0.5s ease;
}
.settings-toggle svg{ display:block; width:100%; height:100%; }
/* only ever visible while the pointer is moving, or the panel is open */
body.pointer-active .settings-toggle{ opacity:0.35; }
.settings-toggle:hover,
body.panel-open .settings-toggle{ opacity:0.75; }
.settings-toggle:focus-visible{ opacity:0.75; outline:1px solid var(--fg-dim); outline-offset:6px; }

/* A card hovering under the gear, lifted off the page by a soft shadow — the look from
   the promo video. A touch of the text colour in its surface sets it apart from the page
   in either mode: a shade darker in light, a shade lighter in dark. */
.panel{
  --card:color-mix(in srgb, var(--panel-bg) 92%, var(--fg));
  position:fixed;
  top:66px; right:24px;
  z-index:5;
  display:flex;
  flex-direction:column;
  gap:22px;
  width:min(320px, calc(100vw - 32px));
  max-height:calc(100vh - 90px);
  padding:24px 28px 20px;
  color:var(--fg);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.05),
    0 30px 80px -10px rgba(0,0,0,0.28);
  /* The panel keeps one face whatever the theme. Set in the theme's own, every label's
     line height changed with each pick and the list slid out from under the pointer. */
  font-family:'Helvetica Neue',Arial,sans-serif;
  overflow-y:auto;
  overscroll-behavior:contain;
  transform-origin:top right;
  transform:translateY(-6px) scale(0.97);
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:
    opacity 0.2s ease,
    transform 0.26s cubic-bezier(0.2,0.7,0.2,1),
    visibility 0s linear 0.26s;
}
.panel[hidden]{ display:flex; }
body.panel-open .panel{
  transform:none;
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition:
    opacity 0.2s ease,
    transform 0.26s cubic-bezier(0.2,0.7,0.2,1),
    visibility 0s;
}

.panel-title{
  /* a section that can be switched off carries its switch at the end of its heading */
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:-6px;
  font-size:11px;
  font-weight:400;
  letter-spacing:0.24em;
  text-transform:uppercase;
  color:var(--fg-dim);
}
.panel-title:not(:first-child){ margin-top:8px; }

.field{ display:flex; flex-direction:column; gap:12px; }
/* .field sets display:flex, which outranks the UA rule for [hidden] — same trap the
   .panel[hidden] line above documents. */
.field[hidden]{ display:none; }
.field-label{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:24px;
  font-size:15px;
  color:var(--fg);
}
.field-value{ color:var(--fg-dim); font-variant-numeric:tabular-nums; }
.field-note{
  font-size:12px;
  line-height:1.5;
  color:var(--fg-dim);
}

/* A rounded track filled with the accent up to the thumb; js/settings.js keeps --fill
   in step with the value. */
input[type=range]{
  --fill:50%;
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:4px;
  margin:4px 0;
  border-radius:2px;
  background:linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill));
  cursor:pointer;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:18px;height:18px;
  border-radius:50%;
  background:var(--fg);
  box-shadow:0 2px 6px rgba(0,0,0,0.25);
  transition:transform 0.15s ease;
}
input[type=range]::-moz-range-thumb{
  width:18px;height:18px;
  border:none;
  border-radius:50%;
  background:var(--fg);
  box-shadow:0 2px 6px rgba(0,0,0,0.25);
  transition:transform 0.15s ease;
}
input[type=range]:active::-webkit-slider-thumb{ transform:scale(1.15); }
input[type=range]:active::-moz-range-thumb{ transform:scale(1.15); }
input[type=range]:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:8px; }
/* Weight, under a theme whose typeface has only the one */
input[type=range]:disabled{ opacity:0.35; cursor:default; }

/* Rows that light up under the pointer and stay lit when chosen. They reach a little past
   the text column on both sides so the highlight frames the text rather than hugging it. */
/* two to a row, so ten themes still leave the panel short enough for a 1080p window */
.choices{ display:grid; grid-template-columns:1fr 1fr; gap:2px 4px; margin:0 -12px; }
.choice{
  display:flex;
  align-items:center;
  gap:14px;
  padding:9px 12px;
  font-family:inherit;
  /* fixed, so theme names set in their own faces all make rows of one height */
  line-height:20px;
  font-size:15px;
  text-align:left;
  color:var(--fg-dim);
  background:none;
  border:none;
  border-radius:10px;
  cursor:pointer;
  transition:background-color 0.15s ease, color 0.15s ease;
}
.choice:hover{ color:var(--fg); background:color-mix(in srgb, var(--accent) 8%, transparent); }
.choice[aria-checked=true]{ color:var(--fg); background:color-mix(in srgb, var(--accent) 18%, transparent); }
.choice:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:-1px; }

/* The city search: the chosen city sits in the box, and typing over it lists matches
   right underneath, each with its region and country to tell the Portlands apart. */
.city-search{ display:flex; flex-direction:column; gap:4px; }
.city-search[hidden]{ display:none; }
.city-results{ display:flex; flex-direction:column; margin:0 -12px; }
.city-results[hidden]{ display:none; }
.city-result{
  display:flex;
  flex-direction:column;
  gap:1px;
  padding:7px 12px;
  font-family:inherit;
  font-size:15px;
  line-height:20px;
  text-align:left;
  color:var(--fg);
  background:none;
  border:none;
  border-radius:10px;
  cursor:pointer;
}
.city-result:hover,
.city-result:focus-visible{ outline:none; background:color-mix(in srgb, var(--accent) 12%, transparent); }
.city-region{ font-size:12px; line-height:16px; color:var(--fg-dim); }
.city-empty{ padding:7px 12px; font-size:12px; color:var(--fg-dim); }

.theme-choice{ font-size:16px; }
/* the theme's accent in the current mode; the edge keeps a pale one from vanishing */
.theme-dot{
  flex-shrink:0;
  width:12px; height:12px;
  border-radius:50%;
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--fg) 12%, transparent);
  transition:background-color 0.3s ease;
}

/* Light/dark, for every theme: a pill with a sun, a screen (whatever the computer is set
   to) and a moon, the knob behind the picked one. */
.mode-switch{
  position:relative;
  flex-shrink:0;
  display:flex;
  padding:0 2px;
  background:var(--line);
  border-radius:14px;
}
.mode-knob{
  position:absolute;
  top:3px; left:4px;
  width:22px; height:22px;
  border-radius:50%;
  background:var(--bg);
  box-shadow:0 1px 3px rgba(0,0,0,0.2);
  transition:transform 0.2s ease;
}
.mode-switch[data-mode=system] .mode-knob{ transform:translateX(26px); }
.mode-switch[data-mode=dark] .mode-knob{ transform:translateX(52px); }
.mode-switch button{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:26px; height:28px;
  padding:0;
  color:var(--fg-dim);
  background:none;
  border:none;
  border-radius:14px;
  cursor:pointer;
  transition:color 0.2s ease;
}
.mode-switch button:hover,
.mode-switch button[aria-checked=true]{ color:var(--fg); }
.mode-switch svg{ width:14px; height:14px; }
.mode-switch button:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:-1px; }

.switch{
  position:relative;
  flex-shrink:0;
  width:44px; height:24px;
  padding:0;
  background:var(--line);
  border:none;
  border-radius:12px;
  cursor:pointer;
  transition:background-color 0.2s ease;
}
.switch i{
  position:absolute;
  top:3px; left:3px;
  width:18px; height:18px;
  border-radius:50%;
  background:var(--bg);
  box-shadow:0 1px 3px rgba(0,0,0,0.2);
  transition:transform 0.2s ease;
}
.switch[aria-checked=true]{ background:var(--accent); }
.switch[aria-checked=true] i{ transform:translateX(20px); }
.switch:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:3px; }

/* Text, date and time fields: a hairline box in the panel's own face. color-scheme on
   the page keeps the browser's date and time pickers in the current mode. */
.text-input{
  width:100%;
  min-width:0;
  padding:8px 12px;
  font-family:inherit;
  font-size:15px;
  line-height:20px;
  color:var(--fg);
  background:color-mix(in srgb, var(--bg) 60%, transparent);
  border:1px solid var(--line);
  border-radius:10px;
  transition:border-color 0.15s ease;
}
.text-input::placeholder{ color:var(--fg-dim); opacity:0.8; }
.text-input:focus{ outline:none; border-color:var(--accent); }
.text-input::-webkit-calendar-picker-indicator{ opacity:0.5; cursor:pointer; }
.input-row{ display:grid; grid-template-columns:1.35fr 1fr; gap:8px; }

.panel-footer{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  white-space:nowrap;
}
/* "What is this?" and Install are the panel's two last things to do, so they sit together
   as a pair of quiet lines, the question before the install; the divider comes after them,
   above who made it. */
.panel-footer + .install-field:not([hidden]){ margin-top:-12px; }
.text-button{
  padding:0;
  font-family:inherit;
  font-size:11px;
  letter-spacing:0.18em;
  text-transform:uppercase;
  text-align:left;
  color:var(--fg-dim);
  background:none;
  border:none;
  cursor:pointer;
}
.text-button:hover{ color:var(--fg); }
.text-button:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:3px; }
.panel-footer .dot{
  width:3px; height:3px;
  border-radius:50%;
  background:var(--fg-dim);
  opacity:0.6;
}

/* "Install as an app": a quiet line of its own above the footer, its mark in the accent
   like the films' play mark. */
.install-field{ align-items:center; text-align:center; }
.install-button{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.install-button svg{ width:14px; height:14px; color:var(--accent); }

/* "What is this?", answered with the films: the same quiet capitals, with a small play
   mark in the theme's accent so it reads as something to watch, not another setting. */
.watch-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  text-decoration:none;
}
.watch-link svg{
  width:9px; height:9px;
  color:var(--accent);
  flex-shrink:0;
}

/* The signature under the footer: the mark in the theme's own accent and text colour, the
   name in Jost's tracked capitals whatever the theme, then the version. Its two halves
   are buttons of their own, so each lights up on its own hover. */
.panel-version{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:9px;
  padding-top:18px;
  border-top:1px solid color-mix(in srgb, var(--line) 70%, transparent);
  font-size:11px;
  letter-spacing:0.12em;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
  color:var(--fg-dim);
}
.signature-button{
  display:flex;
  align-items:center;
  gap:9px;
  padding:0;
  font:inherit;
  letter-spacing:inherit;
  color:inherit;
  opacity:0.7;
  background:none;
  border:none;
  cursor:pointer;
  transition:opacity 0.15s ease;
}
.signature-button:hover{ opacity:1; }
.signature-button:focus-visible{ opacity:1; outline:1px solid var(--fg-dim); outline-offset:3px; }
.brand-mark{ width:22px; height:22px; flex-shrink:0; }
.brand-dial{ stroke:var(--accent); }
.brand-hands{ stroke:var(--fg); }
.brand-name{
  margin-right:-0.24em; /* the tracking's trailing space, so the gap to the dot stays even */
  font-family:'Jost Label','Jost','Helvetica Neue',Arial,sans-serif;
  font-weight:400;
  letter-spacing:0.24em;
  text-transform:uppercase;
  color:var(--fg);
}
.panel-version .dot{
  width:3px; height:3px;
  border-radius:50%;
  background:var(--accent-2);
  opacity:0.7;
}

/* The Lorén Labs badge (Lorén Labs design system, LabBadge): the small cut of the Lorén
   Labs mark on its tile, and the words. The tile flips with light and dark but never takes
   the theme's colours; the words do, quiet like the signature, up to full on hover. */
.lab-badge-row{ display:flex; justify-content:center; }
.lab-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:4px 11px; /* clear space: half the tile */
  font-family:'Helvetica Neue',Arial,sans-serif;
  font-size:12px;
  font-weight:600;
  letter-spacing:0.01em;
  color:var(--fg-dim);
  text-decoration:none;
  border-radius:6px;
  transition:color 0.15s ease;
  -webkit-tap-highlight-color:transparent;
}
.lab-badge:hover{ color:var(--fg); }
.lab-badge:focus-visible{ color:var(--fg); outline:1px solid var(--fg-dim); outline-offset:2px; }
.lab-tile{
  --ll-tile:#2e2d2a; --ll-flask:#e8e3d8; --ll-liquid:#355e5e;
  --ll-tile:light-dark(#2e2d2a, #e8e3d8);
  --ll-flask:light-dark(#e8e3d8, #2e2d2a);
  --ll-liquid:light-dark(#355e5e, #84aca8);
  flex:none;
  display:inline-flex;
  width:22px; height:22px;
  border-radius:6px;
  background:var(--ll-tile);
  overflow:hidden;
}
.lab-tile svg{ display:block; }
.lab-flask{ fill:var(--ll-flask); }
.lab-liquid{ fill:var(--ll-liquid); }
.panel .lab-badge-row{ margin-top:-14px; margin-bottom:-6px; }
/* In the panel the badge signs off under the signature, so it speaks at the signature's
   volume: smaller, lighter words at the same dimmed opacity. The tile stays as it is. */
.panel .lab-badge{ font-size:11px; font-weight:500; letter-spacing:0.02em; opacity:0.7; transition:opacity 0.15s ease, color 0.15s ease; }
.panel .lab-badge:hover, .panel .lab-badge:focus-visible{ opacity:1; }
.panel .lab-tile{ width:20px; height:20px; border-radius:5px; }
.panel .lab-tile svg{ width:20px; height:20px; }

@media (max-width:480px){
  .panel{ right:16px; }
}

/* ---- what's new ---- */

/* The note after an update: a quiet pill just left of the gear, in the panel's surface.
   Unlike the gear it stays visible while the pointer is still — on an unattended screen
   it is the only way anyone finds out — but it never covers the clock. */
.news{
  --card:color-mix(in srgb, var(--panel-bg) 92%, var(--fg));
  position:absolute;
  top:24px; right:62px;
  z-index:6;
  display:none;
  align-items:center;
  gap:7px;
  padding:7px 13px 7px 11px;
  font-family:'Helvetica Neue',Arial,sans-serif;
  font-size:11px;
  letter-spacing:0.16em;
  text-transform:uppercase;
  white-space:nowrap;
  color:var(--fg-dim);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:999px;
  cursor:pointer;
  transition:color 0.2s ease, opacity 0.2s ease;
}
.news.shown{ display:flex; animation:news-in 0.6s ease 0.8s backwards; }
.news svg{ width:14px; height:14px; color:var(--accent); }
.news:hover{ color:var(--fg); }
.news:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:3px; }
/* the open panel sits right below; the pill steps out of its way */
body.panel-open .news{ opacity:0; pointer-events:none; }
@keyframes news-in{ from{ opacity:0; transform:translateY(-4px); } }
/* On the old address "We've moved" takes the pill's place (js/moved.js); release news
   can wait for the new one. */
body.moved #news{ display:none; }
/* the moved dialog's way out is a link, dressed as the other dialogs' button */
a.about-close{ display:block; text-align:center; text-decoration:none; box-sizing:border-box; }
.moved-later{
  display:block;
  width:100%;
  margin-top:10px;
  padding:6px;
  font-family:inherit;
  font-size:12.5px;
  letter-spacing:0.06em;
  color:var(--fg-dim);
  background:none;
  border:none;
  cursor:pointer;
}
.moved-later:hover{ color:var(--fg); }
.moved-later:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:2px; border-radius:4px; }

/* one block per release in the dialog, newest first, under a version-and-date line */
.release-version{
  margin-bottom:-6px;
  font-variant-numeric:tabular-nums;
}
/* a release's film, above its notes; the dialog widens to give it room */
.about.with-film{ width:min(600px, calc(100vw - 32px)); }
.release-film{
  display:block;
  width:100%;
  height:auto;
  margin:16px 0 4px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#000;
}
/* "New", "Improved": a small label over the notes it sorts */
.release-group{
  margin:14px 0 -8px;
  font-size:11px;
  letter-spacing:0.2em;
  text-transform:uppercase;
  color:var(--accent);
}
.release + .release{
  margin-top:30px;
  padding-top:24px;
  border-top:1px solid var(--line);
}

@media (max-width:480px){
  .news{ top:22px; right:58px; }
}

/* ---- installed, title bar hidden ---- */

/* Installed from Chrome or Edge, the window's title bar gives way to the clock and only
   its buttons float over the page: top right on Windows, top left on a Mac. That top row
   is still where the window is dragged from, so .titlebar covers it, and the gear and the
   pill move up into it, clear of the buttons on whichever side they are. Everywhere else
   (a browser tab, Safari's Dock app, full screen) none of this applies. */
.titlebar{ display:none; }

@media (display-mode: window-controls-overlay){
  :root{
    --titlebar-height:env(titlebar-area-height, 0px);
    /* what the window buttons take up on the right; about nothing on a Mac */
    --controls-right:calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw));
  }
  .titlebar{
    display:block;
    position:fixed;
    left:env(titlebar-area-x, 0);
    top:env(titlebar-area-y, 0);
    width:env(titlebar-area-width, 100%);
    height:var(--titlebar-height);
    z-index:4;
    app-region:drag;
    -webkit-app-region:drag;
  }
  .settings-toggle{
    top:calc((var(--titlebar-height) - 20px) / 2);
    right:max(30px, calc(var(--controls-right) + 16px));
  }
  .news{
    top:calc((var(--titlebar-height) - 28px) / 2);
    right:max(62px, calc(var(--controls-right) + 48px));
  }
  .panel{ top:calc(var(--titlebar-height) + 10px); }
  .settings-toggle, .news, .panel{
    app-region:no-drag;
    -webkit-app-region:no-drag;
  }
}

/* ---- what is this? ---- */

/* Dressed like the settings panel — its surface, its rule colour, its one fixed face —
   with the title in the theme's display face so it still looks like this clock's. */
.about{
  /* the <dialog> itself is only the frame; padding lives on .about-body so a click on
     the dialog element can only mean the backdrop */
  padding:0;
  margin:auto;
  width:min(480px, calc(100vw - 32px));
  max-height:calc(100vh - 32px);
  overflow:hidden;
  color:var(--fg);
  background:var(--panel-bg);
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:0 24px 60px -20px rgba(0,0,0,0.35);
  font-family:'Helvetica Neue',Arial,sans-serif;
}
.about[open]{
  /* the text scrolls on a short screen; the way out stays pinned beneath it */
  display:flex;
  flex-direction:column;
  animation:about-in 0.32s cubic-bezier(0.2,0.7,0.2,1);
}
.about::backdrop{
  background:color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.about[open]::backdrop{ animation:about-fade 0.32s ease; }
@keyframes about-in{ from{ opacity:0; transform:translateY(10px) scale(0.98); } }
@keyframes about-fade{ from{ opacity:0; } }

.about-body{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  padding:36px 36px 8px;
}
.about-footer{
  flex-shrink:0;
  padding:0 36px 30px;
}
/* a rule between the text and the button, so text cut off by scrolling ends on a line */
.about-footer::before{
  content:'';
  display:block;
  border-top:1px solid var(--line);
}
/* The mark and the name heading the intro and the release notes, in the theme's own
   colours, set like the signature at the foot of the settings panel. */
.dialog-brand{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:20px;
  font-size:13px;
}
.dialog-brand svg{ width:52px; height:52px; flex-shrink:0; }
.dialog-brand.small{ gap:12px; margin-bottom:16px; font-size:12px; }
.dialog-brand.small svg{ width:36px; height:36px; }

.about-title{
  margin-bottom:12px;
  font-family:var(--font-display);
  font-size:26px;
  font-weight:400;
  letter-spacing:-0.01em;
  line-height:1.2;
}
.about-lead{
  margin-bottom:6px;
  font-size:15px;
  line-height:1.55;
  color:var(--fg);
}
.about h3{
  display:flex;
  align-items:center;
  gap:8px;
  margin:22px 0 6px;
  font-size:11px;
  font-weight:400;
  letter-spacing:0.18em;
  text-transform:uppercase;
  color:var(--accent);
}
.about-emoji{
  font-size:16px;
  letter-spacing:0;
}
.about p{
  font-size:14px;
  line-height:1.6;
  color:var(--fg-dim);
}
.about .about-lead{ color:var(--fg); }

/* The intro is wider than the release notes: its three points sit side by side. */
.about.intro{ width:min(600px, calc(100vw - 32px)); }
.about-points{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:20px;
  margin-top:22px;
}
.about-points h3{
  flex-direction:column;
  align-items:flex-start;
  gap:7px;
  margin:0 0 6px;
}
.about-points .about-emoji{ font-size:19px; }
.about-points p{ font-size:13.5px; line-height:1.55; }

/* The F11 tip: the one boxed thing in the intro, tinted with the theme's accent. */
.about-tip{
  margin-top:24px;
  padding:15px 18px 16px;
  border-radius:12px;
  background:color-mix(in srgb, var(--accent) 9%, var(--panel-bg));
  border:1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.about-tip h3{ margin:0 0 6px; }
.about .about-tip p{ line-height:1.65; color:var(--fg); }
.about .about-tip .about-small{ margin-top:6px; font-size:12.5px; color:var(--fg-dim); }
.about kbd{
  position:relative;
  top:-1px;
  display:inline-block;
  min-width:1.8em;
  padding:0 6px;
  font-family:inherit;
  font-size:12px;
  font-weight:500;
  line-height:1.6;
  text-align:center;
  color:var(--fg);
  background:var(--panel-bg);
  border:1px solid var(--line);
  border-bottom-width:2px;
  border-radius:5px;
}

/* Weather, settings and the film: one quiet line each, under an emoji. */
.about-fine{
  display:grid;
  gap:8px;
  margin-top:22px;
  padding:0;
  list-style:none;
}
.about-fine li{
  display:grid;
  grid-template-columns:24px minmax(0, 1fr);
  font-size:13px;
  line-height:1.55;
  color:var(--fg-dim);
}
.about-link{
  color:var(--accent);
  text-decoration:underline;
  text-decoration-color:color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset:3px;
  transition:text-decoration-color 0.2s ease;
}
.about-link:hover{ text-decoration-color:var(--accent); }
.about-link:focus-visible{ outline:1px solid var(--accent); outline-offset:2px; border-radius:2px; }
.about-close{
  margin-top:20px;
  width:100%;
  padding:12px 16px;
  font-family:inherit;
  font-size:13px;
  letter-spacing:0.06em;
  color:var(--bg);
  background:var(--fg);
  border:none;
  border-radius:8px;
  cursor:pointer;
  transition:opacity 0.2s ease;
}
.about-close:hover{ opacity:0.85; }
.about-close:focus-visible{ outline:1px solid var(--fg); outline-offset:3px; }

/* too narrow for three columns: the points stack, each heading back on one line */
@media (max-width:600px){
  .about-points{ grid-template-columns:minmax(0, 1fr); gap:14px; }
  .about-points h3{ flex-direction:row; align-items:center; gap:8px; }
  .about-points .about-emoji{ font-size:16px; }
}

@media (max-width:480px){
  .about-body{ padding:28px 22px 8px; }
  .about-footer{ padding:0 22px 22px; }
  .about-title{ font-size:22px; }
}

/* ---- insane mode ---- */

/* The everyday part (js/warp.js): a sky flown through behind the clock, the seconds on,
   and the figures run edge to edge with a red and cyan fringe that flares each second. */
.warp{
  position:absolute;
  inset:0;
  z-index:0;
  width:100%; height:100%;
  pointer-events:none;
  opacity:0;
  transition:opacity 0.8s ease;
}
body.insane-mode .warp{ opacity:1; }
.time .secs{ display:none; }
body.insane-mode .time .secs{ display:inline; }
/* the seconds' colon holds still; the minutes' one does the blinking */
.time .secs .colon{ animation:none; }
body.insane-mode .time{
  font-size:calc(clamp(72px, 14vw, 30vh) * var(--size) * var(--time-scale));
  text-shadow:
    var(--fringe, 1.5px) 0 0 rgba(255, 40, 90, 0.55),
    calc(var(--fringe, 1.5px) * -1) 0 0 rgba(0, 220, 255, 0.55);
}

/* The progress bar as a lit fuse: it runs from the theme's accent into fire towards its
   head, and glows. The head itself, and its sparks, are drawn on the sky by js/warp.js. */
body.insane-mode .seconds-track{
  background:linear-gradient(90deg, var(--accent) 0%, var(--accent) calc(100% - 140px), #e8264f calc(100% - 60px), #ff8a1f calc(100% - 16px), #ffe08a);
  box-shadow:0 0 10px rgba(255, 122, 26, 0.55), 0 0 22px rgba(232, 38, 79, 0.35);
}
body.insane-mode .seconds-rail{ background:color-mix(in srgb, var(--line) 35%, transparent); }

/* ---- the mood: zen, normal, insane ---- */

/* At the top of the panel, wider and taller than light/dark: three icons with their
   names, and the knob behind the picked one. Insane's runs hot. */
.mood-switch{
  position:relative;
  flex-shrink:0;
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  padding:4px;
  background:var(--line);
  border-radius:16px;
}
.mood-knob{
  position:absolute;
  top:4px; bottom:4px; left:4px;
  width:calc((100% - 8px) / 3);
  border-radius:12px;
  background:var(--bg);
  box-shadow:0 1px 3px rgba(0,0,0,0.2);
  transition:transform 0.25s cubic-bezier(0.3, 1.3, 0.5, 1), background 0.25s ease;
}
.mood-switch[data-mood=normal] .mood-knob{ transform:translateX(100%); }
.mood-switch[data-mood=insane] .mood-knob{
  transform:translateX(200%);
  background:linear-gradient(90deg, #e8264f, #ff8a1f);
}
.mood-switch button{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:4px;
  height:56px;
  padding:0;
  font-family:inherit;
  font-size:12px;
  letter-spacing:0.04em;
  color:var(--fg-dim);
  background:none;
  border:none;
  border-radius:12px;
  cursor:pointer;
  transition:color 0.2s ease;
}
.mood-switch button:hover,
.mood-switch button[aria-checked=true]{ color:var(--fg); }
.mood-switch button[data-mood=insane][aria-checked=true]{ color:#fff; }
.mood-switch svg{ width:20px; height:20px; }
.mood-switch button:focus-visible{ outline:1px solid var(--fg-dim); outline-offset:-1px; }
/* a little jolt as the knob lands on Insane */
.mood-switch[data-mood=insane] button[data-mood=insane][aria-checked=true] svg{ animation:mood-zap 0.45s ease-out; }
@keyframes mood-zap{
  0%{ transform:scale(1); }
  30%{ transform:scale(1.35) rotate(-12deg); }
  55%{ transform:scale(0.9) rotate(8deg); }
  100%{ transform:none; }
}

/* Between moods, a short splash: the mark draws itself with the name under it and the
   mood it's going to, the clock changes behind it, and it lifts. It sits under the panel,
   so the switch you just pressed stays in view. js/splash.js plays it. */
.shift{
  position:fixed;
  inset:0;
  z-index:4;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:clamp(18px, 2.4vh, 30px);
  background:
    radial-gradient(circle at 15% 85%, color-mix(in srgb, var(--accent-2) 16%, transparent), transparent 55%),
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    var(--bg);
  pointer-events:none;
  animation:shift-in 0.35s ease both, shift-out 0.55s ease 1.35s forwards;
}
.shift .splash-mark{ width:clamp(64px, 8vh, 110px); height:clamp(64px, 8vh, 110px); animation:splash-settle 1s cubic-bezier(0.33, 1, 0.68, 1) both; }
.shift .splash-mark path{ stroke-dasharray:1; stroke-dashoffset:1; }
.shift .brand-dial{ animation:splash-draw 0.6s cubic-bezier(0.65, 0, 0.35, 1) 0.1s forwards; }
.shift .brand-hands{ animation:splash-draw 0.36s cubic-bezier(0.65, 0, 0.35, 1) 0.55s forwards; }
.shift .brand-name{ font-size:clamp(13px, 1.7vh, 22px); opacity:0; animation:splash-rise 0.45s cubic-bezier(0.33, 1, 0.68, 1) 0.5s forwards; }
.shift-mood{
  margin-top:calc(clamp(18px, 2.4vh, 30px) * -0.55);
  font-family:'Jost Label','Jost','Helvetica Neue',Arial,sans-serif;
  font-size:clamp(10px, 1.2vh, 14px);
  letter-spacing:0.32em;
  margin-right:-0.32em;
  text-transform:uppercase;
  color:var(--accent);
  opacity:0;
  animation:splash-rise 0.45s cubic-bezier(0.33, 1, 0.68, 1) 0.65s forwards;
}
/* Into Zen it lingers and lifts slowly. */
.shift.to-zen{ animation:shift-in 0.45s ease both, shift-out 0.9s ease 1.4s forwards; }
/* Into Insane the mark rattles, its fringe splits red and cyan, and it lifts on a flash. */
.shift.to-insane .shift-mood{ color:#ff5a3c; }
.shift.to-insane .splash-mark{
  animation:splash-settle 1s cubic-bezier(0.33, 1, 0.68, 1) both, shift-rattle 0.08s linear 0.85s 6;
  filter:drop-shadow(2px 0 0 rgba(255, 40, 90, 0.8)) drop-shadow(-2px 0 0 rgba(0, 220, 255, 0.8));
}
.shift.to-insane::after{
  content:'';
  position:absolute;
  inset:0;
  background:#fff;
  opacity:0;
  animation:shift-flash 0.55s ease-out 1.3s forwards;
}
.shift.to-insane{ animation:shift-in 0.3s ease both, shift-out 0.4s ease 1.4s forwards; }
@keyframes shift-in{ from{ opacity:0; } }
@keyframes shift-out{ to{ opacity:0; visibility:hidden; } }
@keyframes shift-rattle{
  25%{ transform:translate(-3px, 1px) rotate(-2deg); }
  50%{ transform:translate(3px, -1px) rotate(2deg); }
  75%{ transform:translate(-2px, -1px); }
}
@keyframes shift-flash{ 0%{ opacity:0; } 25%{ opacity:0.85; } 100%{ opacity:0; } }

/* ---- zen mode ---- */

/* The clock, its date, calendar, weather and bar all step back, and js/zen.js's layer
   comes up in their place. Faded rather than removed, so the column keeps its layout and
   js/fit.js its measurements, and switching back is a crossfade too. */
.center,
.seconds-rail{ transition:opacity 0.8s ease, visibility 0s linear 0s, background-color 0.4s ease; }
body.zen-mode .center,
body.zen-mode .seconds-rail{ opacity:0; visibility:hidden; transition:opacity 0.8s ease, visibility 0s linear 0.8s, background-color 0.4s ease; }

.zen{
  position:absolute;
  inset:0;
  z-index:3;
  overflow:hidden;
  opacity:0;
  visibility:hidden;
  transition:opacity 0.8s ease, visibility 0s linear 0.8s;
  -webkit-tap-highlight-color:transparent;
}
body.zen-mode .zen{ opacity:1; visibility:visible; transition:opacity 0.8s ease, visibility 0s linear 0s; }

/* Big soft pools of the theme's own colours, drifting so slowly that you only notice
   they've moved when you look away and back. Still while Zen is off. */
.zen-field{ position:absolute; inset:0; }
.zen-pool{
  position:absolute;
  width:95vmax; height:95vmax;
  border-radius:50%;
  animation:zen-drift linear infinite alternate;
  will-change:transform;
}
body:not(.zen-mode) .zen-pool{ animation-play-state:paused; }
.zen-pool.a{ left:-35vmax; top:-40vmax; --dx:38vmax; --dy:22vmax; animation-duration:170s;
  background:radial-gradient(circle, color-mix(in srgb, var(--accent-2) 55%, transparent) 0%, transparent 62%); }
.zen-pool.b{ right:-40vmax; bottom:-45vmax; --dx:-30vmax; --dy:-26vmax; animation-duration:230s;
  background:radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent) 0%, transparent 60%); }
.zen-pool.c{ left:10vmax; bottom:-55vmax; --dx:24vmax; --dy:-34vmax; animation-duration:290s;
  background:radial-gradient(circle, color-mix(in srgb, var(--accent-2) 40%, transparent) 0%, transparent 58%); }
.zen-pool.d{ right:-20vmax; top:-50vmax; --dx:-36vmax; --dy:30vmax; animation-duration:350s;
  background:radial-gradient(circle, color-mix(in srgb, var(--fg) 9%, transparent) 0%, transparent 55%); }
@keyframes zen-drift{
  from{ transform:translate(0, 0) scale(1); }
  to{ transform:translate(var(--dx), var(--dy)) scale(1.18); }
}

/* The mark, sized with the Scale slider. As the time it runs wider than the dial, out
   past the box on either side. */
.zen-clock-box{
  position:absolute;
  left:50%; top:50%;
  width:calc(min(40vmin, 380px) * var(--ui-scale));
  aspect-ratio:1;
  transform:translate(-50%, -50%);
  cursor:pointer;
}
.zen-clock{
  display:block;
  width:100%; height:100%;
  overflow:visible;
  animation:zen-breathe 11s ease-in-out infinite alternate;
  --turn:0;
}
body:not(.zen-mode) .zen-clock{ animation-play-state:paused; }
@keyframes zen-breathe{ to{ transform:scale(1.025); } }
/* Square ends and corners, as in the mark. Corners sharper than about 60° (the top of the
   4, the foot of the 2) are cut flat rather than left to spike out. */
.zen-clock path{ fill:none; stroke-linecap:butt; stroke-linejoin:miter; stroke-miterlimit:2; }
/* As the mark: the dial in the accent, the hands in ink. As the time it turns over, the
   way the clock colours its figures and colon. --turn follows the movement itself. */
.zen-piece{ stroke:color-mix(in srgb, var(--fg) calc(var(--turn) * 100%), var(--accent)); }
.zen-hand{ stroke:color-mix(in srgb, var(--accent) calc(var(--turn) * 100%), var(--fg)); }

/* A countdown landing in Zen: the mark blooms and turns once, and a ring of the accent
   spreads from it and fades. */
.zen-clock-box::after{
  content:'';
  position:absolute;
  inset:0;
  border-radius:50%;
  border:2px solid var(--accent);
  opacity:0;
  pointer-events:none;
}
.zen-clock-box.zen-arrive{ animation:zen-arrive 2.6s cubic-bezier(0.45, 0, 0.2, 1); }
.zen-clock-box.zen-arrive::after{ animation:zen-ring 2.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes zen-arrive{
  0%{ transform:translate(-50%, -50%); }
  40%{ transform:translate(-50%, -50%) scale(1.14) rotate(200deg); }
  100%{ transform:translate(-50%, -50%) rotate(360deg); }
}
@keyframes zen-ring{
  0%{ transform:scale(0.9); opacity:0; }
  15%{ opacity:0.7; }
  100%{ transform:scale(2.6); opacity:0; }
}

@media (prefers-reduced-motion: reduce){
  .zen-pool, .zen-clock{ animation:none; }
  .zen-clock-box.zen-arrive{ animation:none; }
}

/* What js/insane.js puts over the page: a canvas of space and debris that shakes, the
   countdown line flying in the middle of it, and a white sheet for the flashes. */
.insane{ position:fixed; inset:0; z-index:50; }
.insane-shaker{ position:fixed; inset:0; }
.insane canvas{ position:absolute; display:block; }
.insane-flash{ position:fixed; inset:0; background:#fff; opacity:0; pointer-events:none; }
.countdown.insane-hero{
  position:fixed;
  margin:0;
  white-space:nowrap;
  color:#eef2ff;
  transform-origin:center;
}
.insane-hero .dot{ background:var(--accent); }
/* and the clock, back from the trip, settling into focus */
.stage.insane-return{ animation:insane-return 1.1s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes insane-return{ from{ transform:scale(1.12); filter:blur(14px); } }

@media (prefers-reduced-motion: reduce){
  .splash{ display:none; }
  .stage.insane-return{ animation:none; }
  .time .colon, .countdown-value{ animation:none; transition:none; }
  .panel{ transition:none; }
  .seconds-track{ transition:none; }
  html,body,.stage{ transition:none; }
  .switch,.switch i,.mode-knob,.mode-switch button,.mood-knob,.mood-switch button,.choice,.theme-dot{ transition:none; }
  .mood-switch svg{ animation:none !important; }
  .about[open],.about[open]::backdrop,.news.shown{ animation:none; }
}
