/* time.seamus.win: friendly glass over a sky that follows the sun at the place shown (see sky.js). */

/* Registered so the sky can glide from one colour to the next as the sun moves. */
@property --sky-1 { syntax: "<color>"; inherits: true; initial-value: #86bff7; }
@property --sky-2 { syntax: "<color>"; inherits: true; initial-value: #b3dafb; }
@property --sky-3 { syntax: "<color>"; inherits: true; initial-value: #e4f4fd; }

/* Montserrat ExtraBold for the big clock, only its characters (digits, ":", ".", AM, PM). The page preloads it. */
@font-face {
  font-family: "Montserrat Clock";
  src: url("/clock.woff2?v=o4e9hz") format("woff2");
  font-weight: 800;
  font-display: block;
}

:root {
  --sky-1: #86bff7;
  --sky-2: #b3dafb;
  --sky-3: #e4f4fd;
  --text: #1d1d1f;
  --muted: #5f6370;
  --faint: #8e93a0;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --line: rgba(29, 29, 31, 0.08);
  --shadow: 0 12px 36px rgba(42, 52, 120, 0.14);
  --accent: #5b5bd6;
  --accent-grad: linear-gradient(135deg, #6e8bff 0%, #b56cf0 55%, #ff8fa3 100%);
  --warn: #c2410c;
  /* The logo's blue, violet and pink, deep enough to read on the light skies. */
  --clock-grad: linear-gradient(100deg, #3644d0 0%, #7a2bc0 52%, #c21f5d 100%);
  --clock-glow: rgba(122, 43, 192, 0.22);
  --orb-sun: rgba(255, 236, 170, 0.95);
  --orb-moon: rgba(255, 255, 255, 0.85);
  --night: rgba(29, 29, 31, 0.06);
  --page: #e7edf8;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Varela Round", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-1: #0e376f;
    --sky-2: #1c5ba3;
    --sky-3: #3a80c4;
    --text: #f5f5f7;
    --muted: #b4b7c6;
    --faint: #8a8ea3;
    --glass: rgba(22, 24, 44, 0.5);
    --glass-strong: rgba(28, 30, 54, 0.88);
    --glass-border: rgba(255, 255, 255, 0.1);
    --line: rgba(255, 255, 255, 0.08);
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    --accent: #a5a5ff;
    --warn: #fdba74;
    --clock-grad: linear-gradient(100deg, #a9baff 0%, #dcb0ff 52%, #ffbccb 100%);
    --clock-glow: rgba(10, 8, 40, 0.45);
    --orb-sun: rgba(255, 214, 140, 0.75);
    --orb-moon: rgba(220, 228, 255, 0.7);
    --night: rgba(0, 0, 0, 0.25);
    --page: #10142c;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  /* behind the sky: shows before it fades in and when the page bounces past its ends */
  background: var(--page);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.faint { color: var(--faint); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { color: var(--muted); font-size: 13px; margin-left: 6px; }

/* the sky: a fixed gradient with a soft sun or moon */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  /* Hidden until app.js has worked out the colours for the place, so a night sky never flashes blue first. */
  opacity: 0;
  transition: opacity 0.8s;
}
.sky-ready .sky { opacity: 1; }
.sky-ready { transition: --sky-1 3s, --sky-2 3s, --sky-3 3s; }
.orb {
  --x: 70%;
  --y: 30%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 46vmin;
  height: 46vmin;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--orb-sun) 0%, rgba(255, 210, 140, 0.35) 30%, transparent 65%);
  opacity: var(--orb-opacity, 0.9);
  transition: left 2s, top 2s, opacity 2s;
}
.orb.moon {
  width: 22vmin;
  height: 22vmin;
  background: radial-gradient(circle, var(--orb-moon) 0%, rgba(200, 210, 255, 0.25) 35%, transparent 68%);
}

/* header */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 20px 0;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font: 700 18px var(--rounded); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 4px 12px rgba(91, 91, 214, 0.3); }

/* pills and chips */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 14px var(--font);
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: 0 4px 14px rgba(42, 52, 120, 0.08);
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s;
}
.pill:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(42, 52, 120, 0.14); }
.pill:active { transform: translateY(0) scale(0.98); }
.pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill[aria-pressed="true"] { color: #fff; background: var(--accent-grad); border-color: transparent; box-shadow: 0 8px 22px rgba(181, 108, 240, 0.35); }
.pill.quiet { font-weight: 500; color: var(--muted); }
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  font: 600 12px var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip[hidden] { display: none; }

.sync { padding: 6px 13px; font-size: 13px; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync.ok .dot { background: #30d158; box-shadow: 0 0 0 4px rgba(48, 209, 88, 0.2); }
.sync.warn .dot { background: #ff9f0a; box-shadow: 0 0 0 4px rgba(255, 159, 10, 0.2); }
.sync.bad .dot { background: #ff453a; box-shadow: 0 0 0 4px rgba(255, 69, 58, 0.2); }
.sync.busy .dot { background: #ff9f0a; animation: pulse 1s ease-in-out infinite; }

main { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }

/* search */
.search { position: relative; display: flex; align-items: center; max-width: 520px; margin: 26px auto 0; }
.search-icon { position: absolute; left: 16px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.input {
  width: 100%;
  font: 500 16px var(--font);
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 12px 18px 12px 44px;
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: transparent; box-shadow: 0 0 0 3px rgba(110, 139, 255, 0.45), var(--shadow); }
.suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 18px 44px rgba(20, 24, 60, 0.22);
}
.suggest[hidden] { display: none; }
.suggest li { display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: 14px; cursor: pointer; }
.suggest li.muted { display: block; cursor: default; }
.suggest li:hover, .suggest li.active { background: rgba(110, 139, 255, 0.16); }
.suggest .where { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .when { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.notice {
  max-width: 600px;
  margin: 18px auto 0;
  padding: 10px 18px;
  border-radius: 16px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  text-align: center;
  font-size: 14px;
}
.notice[hidden] { display: none; }

/* hero */
.hero { text-align: center; padding: 38px 0 34px; }
.place { margin: 10px 0 0; font: 700 clamp(24px, 4vw, 34px)/1.2 var(--rounded); letter-spacing: -0.01em; }
.place .flag { margin-right: 10px; }
.place .sub { display: block; margin-top: 4px; color: var(--muted); font: 500 15px var(--font); }
.clock {
  /* Width of the clock in em (measured with Montserrat): 24 hours, then more for tenths and for AM/PM. On small
     screens the font size follows from it, so the clock fills the width without spilling over. */
  --em: 4.7;
  /* As wide as the digits, so the gradient runs from the first digit to the last. */
  width: fit-content;
  margin: 8px auto 6px;
  font: 800 168px/1.1 "Montserrat Clock", var(--rounded);
  font-size: min(168px, calc((100vw - 48px) / var(--em)));
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  background: var(--clock-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 26px var(--clock-glow));
}
.tenth { font-size: 0.4em; margin-left: 0.02em; opacity: 0.6; }
.tenth[hidden] { display: none; }
.period { font-size: 0.3em; margin-left: 0.25em; letter-spacing: 0.02em; }
.period:empty { display: none; }
.clock:has(.tenth:not([hidden])) { --em: 5.05; }
.clock:has(.period:not(:empty)) { --em: 5.3; }
.clock:has(.period:not(:empty)):has(.tenth:not([hidden])) { --em: 5.65; }
/* Montserrat's colon sits low, for text; on the clock it moves up to the middle of the digits. */
.colon { vertical-align: 0.08em; line-height: 0; }
.date { font: 600 18px var(--rounded); }
.zone-line { color: var(--muted); margin-top: 4px; }
.deviation { margin-top: 18px; font-weight: 600; }
.deviation.warn { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }

.details { max-width: 560px; margin: 20px auto 0; text-align: left; }
.details summary {
  width: max-content;
  margin: 0 auto;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: " ›"; display: inline-block; transition: transform 0.2s; }
.details[open] summary::after { transform: rotate(90deg); }
.details summary:hover { color: var(--text); }
.details[open] > :not(summary) { animation: rise 0.25s ease-out; }
.details .kv, .details .how, .details .pill { margin-top: 12px; }
.details .kv { padding: 8px 18px; border-radius: 20px; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.how { color: var(--muted); font-size: 13px; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.card {
  min-width: 0;
  padding: 20px 22px 22px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font: 700 17px var(--rounded); letter-spacing: -0.005em; }
.kv { margin: 0; }
.kv .row { display: grid; grid-template-columns: minmax(110px, 42%) minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv .row:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv dd .sub { display: block; color: var(--faint); font-weight: 500; font-size: 13px; }

/* sun path */
.sunpath { display: block; width: 100%; height: auto; margin: -4px 0 6px; overflow: visible; }
.sunpath .horizon { stroke: var(--line); stroke-width: 2; }
.sunpath .arc { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: 2 6; stroke-linecap: round; }
.sunpath .done { fill: none; stroke: url(#sun-trail); stroke-width: 3; stroke-linecap: round; }
.sunpath .sun { fill: #ffc94d; filter: drop-shadow(0 0 8px rgba(255, 190, 70, 0.9)); }
.sunpath .sun.below { fill: var(--faint); filter: none; }
.sunpath text { fill: var(--muted); font: 600 12px var(--font); }

/* moon */
.moon-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.moon { width: 92px; height: 92px; filter: drop-shadow(0 6px 18px rgba(42, 52, 120, 0.25)); }
.moon-dark { fill: #3b3f5c; }
.moon-lit { fill: #fff4d6; }

/* analog clock */
.analog-card { display: flex; flex-direction: column; }
.analog { display: block; width: min(100%, 320px); margin: auto; }
.analog .face { fill: var(--glass-strong); stroke: var(--glass-border); stroke-width: 1.5; }
.analog .tick { stroke: var(--faint); stroke-width: 1.4; stroke-linecap: round; }
.analog .tick.major { stroke: var(--text); stroke-width: 3; }
.analog .hand { stroke-linecap: round; }
.analog .hour { stroke: var(--text); stroke-width: 7; }
.analog .minute { stroke: var(--text); stroke-width: 4.5; }
.analog .second { stroke: #ff6b8a; stroke-width: 2; }
.analog .pin { fill: #ff6b8a; }

/* time difference */
.compare p { margin: 0 0 6px; }
.compare p:first-child { font: 700 17px var(--rounded); }
.strip { display: flex; gap: 4px; margin-top: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.strip .col { display: grid; gap: 4px; flex: 0 0 auto; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip .col span { padding: 5px 7px; border-radius: 10px; }
.strip .col span:first-child { color: var(--muted); }
.strip .col span:last-child { background: var(--night); color: var(--faint); }
.strip .col.work span:last-child { background: rgba(110, 139, 255, 0.2); color: var(--text); }
.strip .col.edge span:last-child { background: rgba(255, 179, 102, 0.25); color: var(--text); }
.strip .col.now span:last-child { background: var(--accent-grad); color: #fff; }
.strip .labels span { text-align: left; color: var(--muted); background: none !important; }

/* world clock */
.world { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.world li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  grid-template-areas: "icon city rm" "icon when diff";
  column-gap: 10px;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.world li.here { background: rgba(110, 139, 255, 0.18); border-color: rgba(110, 139, 255, 0.4); }
.world .icon { grid-area: icon; align-self: center; font-size: 18px; }
.world .city { grid-area: city; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world .when { grid-area: when; font: 700 22px var(--rounded); font-variant-numeric: tabular-nums; }
.world .when .period { margin-left: 0.25em; font-size: 0.6em; font-weight: 600; color: var(--muted); }
.world .diff { grid-area: diff; color: var(--muted); font-size: 13px; text-align: right; }
.world .rm { grid-area: rm; justify-self: end; background: none; border: 0; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.world .rm:hover { color: #ff453a; }
.world-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.small-search { margin: 0; flex: 1 1 260px; max-width: 360px; }
.small-search .input { padding: 9px 16px 9px 40px; font-size: 15px; box-shadow: none; }
.small-search .search-icon { left: 14px; }

footer { max-width: 1080px; margin: 0 auto; padding: 10px 20px 44px; color: var(--muted); font-size: 13px; text-align: center; }

/* fullscreen: only the clock, large, on the sky */
.is-full { overflow: hidden; }
.is-full .hero {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 24px;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  cursor: zoom-out;
}
.is-full .clock { font-size: min(38vh, calc((100vw - 64px) / var(--em))); }
.is-full .date { font-size: clamp(18px, 2.6vw, 30px); }
.is-full .details, .is-full .deviation, .is-full #btn-tenths, .is-full #btn-hour12 { display: none; }
.is-full .actions { opacity: 0.6; }
.is-full .actions:hover { opacity: 1; }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .sync.busy .dot, .details[open] > :not(summary) { animation: none; }
  .sky, .orb, .pill, .sky-ready { transition: none; }
}

@media (max-width: 820px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 28px 0 26px; }
  .card { padding: 18px; border-radius: 22px; }
  .kv .row { grid-template-columns: minmax(96px, 44%) minmax(0, 1fr); }
  .moon-row { grid-template-columns: 72px minmax(0, 1fr); }
  .moon { width: 72px; height: 72px; }
  .brand .faint { display: none; }
}
