/* Where - single-page status board. Minimal, airy, one quiet timeline. */

:root {
  --bg: #0c0e13;
  --surface: #141722;
  --line: #262c3d;
  --text: #edeff5;
  --muted: #7e8699;
  --faint: #4a5165;
  /* the accent (and every pin/button colour) comes from the status itself,
     inline via --accent / --a; this is only the fallback */
  --accent: #7c8599;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --line: #dcdfe8;
    --text: #1c2130;
    --muted: #6d7488;
    --faint: #b3b9c9;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(55rem 30rem at 50% -14rem,
      color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    var(--bg);
}

.board {
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 9vh, 6rem) 1.5rem 2rem;
}

/* ---- Current status, whispered in the middle ---- */

.now { text-align: center; }

.now-label {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--faint);
}

.now-status {
  margin: 0.6rem 0 0;
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 300;
  letter-spacing: -0.02em;
}

.now-symbol {
  font-size: 0.72em;
  margin-right: 0.35rem;
  vertical-align: 0.06em;
}

.now-since {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.telegram-error {
  width: fit-content;
  margin: 1.4rem auto 0;
  padding: 0.5rem 1rem;
  border: 1px solid color-mix(in srgb, #e5484d 40%, var(--line));
  border-radius: 2rem;
  background: color-mix(in srgb, #e5484d 10%, var(--surface));
  font-size: 0.85rem;
}

/* ---- Actions: quiet pills ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.8rem;
}

.action {
  --a: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

/* a colour chip echoing the preset's timeline colour */
.action::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 0.5rem color-mix(in srgb, var(--a) 45%, transparent);
}

.action:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--a) 55%, var(--line));
  background: color-mix(in srgb, var(--a) 8%, transparent);
}

.action:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }

.action.is-current {
  color: var(--text);
  border-color: color-mix(in srgb, var(--a) 60%, var(--line));
  background: color-mix(in srgb, var(--a) 12%, transparent);
}

/* ---- Set status: colour swatch + name + picture file + go ---- */

.set-form {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.9rem auto 0;
  max-width: 30rem;
}

.set-name,
.set-status {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  min-width: 0;
}

.set-name { flex: 1.4; }
.set-status { flex: 1; }

.set-name::placeholder,
.set-status::placeholder { color: var(--faint); }

/* no Telegram integration - the status text has nowhere to go */
.set-status:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.set-status:disabled::placeholder { color: var(--faint); }

/* no boxy focus ring - just a quiet border tint so focus stays legible */
.set-name:focus,
.set-status:focus,
.set-go:focus,
.set-color input:focus {
  outline: none;
}

.set-name:focus,
.set-status:focus {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

/* wrap the native colour input in a small round chip - a quiet swatch, not
   a full-height control; centred against the taller inputs beside it */
.set-color {
  display: inline-grid;
  place-items: center;
  align-self: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-inline: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex: none;
}

.set-color input[type="color"] {
  width: 150%;
  height: 150%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
/* strip the native swatch chrome so only the colour shows */
.set-color input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.set-color input[type="color"]::-webkit-color-swatch { border: none; }
.set-color input[type="color"]::-moz-color-swatch { border: none; }

.set-go {
  width: 2.1rem;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.set-go:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ---- The 24h line ---- */

.day { margin-top: clamp(3rem, 9vh, 5.5rem); }

.day-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0.2rem 0.4rem;
}

.day h2 {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--faint);
}

.day-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tool {
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.45rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tool:hover { color: var(--text); border-color: var(--muted); }

.tool-clear {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 0.4rem;
}

.tool-clear:hover { color: #e5484d; border-color: color-mix(in srgb, #e5484d 55%, var(--line)); }

/* the scroll viewport, with fades pinned to its edges */
.day-view { position: relative; }

.day-view::before,
.day-view::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3rem;
  z-index: 50;
  pointer-events: none;
}

/* the past always dissolves... */
.day-view::before {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent);
}

/* ...the "now" end only when it's out of view */
.day-view::after {
  right: 0;
  background: linear-gradient(270deg, var(--bg), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.day-view.fade-r::after { opacity: 1; }

.day-scroll {
  overflow-x: auto;
  /* room for the breathing now-dot and edge pins, so nothing gets clipped */
  padding-inline: 1.2rem;
  /* scrollbar never shows: drag, swipe or zoom instead */
  scrollbar-width: none;
  cursor: grab;
  /* native horizontal pan, pinch goes to the zoom script */
  touch-action: pan-x;
}

.day-scroll::-webkit-scrollbar { display: none; }

.day-scroll.dragging { cursor: grabbing; user-select: none; }

.day-inner {
  position: relative;
  min-width: 44rem;
  height: 11rem;
}

/* the axis itself */
.axis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.4rem;
  height: 1px;
  background: var(--line);
}

/* "now": a breathing dot at the right end of the axis; sits above the
   viewport-edge fade so its colour stays vivid */
.now-dot {
  position: absolute;
  right: 0;
  bottom: 2.4rem;
  width: 0.5rem;
  height: 0.5rem;
  transform: translate(50%, 50%);
  border-radius: 50%;
  background: var(--accent);
  z-index: 60;
  animation: breathe 2.6s ease-out infinite;
}

@keyframes breathe {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  70%  { box-shadow: 0 0 0 0.7rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .now-dot { animation: none; }
}

/* hour ticks below the axis */
.tick {
  position: absolute;
  bottom: 2.4rem;
  width: 1px;
  height: 0.4rem;
  transform: translate(-50%, 100%);
  background: var(--faint);
  opacity: 0.55;
}

.tick.major { height: 0.65rem; opacity: 1; }

.tick-label {
  position: absolute;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--faint);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

/* minor hour labels appear once the zoom gives them room */
.tick:not(.major) .tick-label { display: none; }
.day-inner.zoomed .tick .tick-label { display: block; }

/* status pins above the axis */
.pin {
  position: absolute;
  bottom: 2.4rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin { --a: var(--accent); }

/* staggered stem heights so neighbouring pins breathe */
.pin.lvl-0 .pin-stem { height: 2.1rem; }
.pin.lvl-1 .pin-stem { height: 3.3rem; }
.pin.lvl-2 .pin-stem { height: 4.5rem; }

.pin-stem {
  order: 3;
  width: 1px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--a) 65%, transparent), transparent);
}

.pin-head {
  order: 2;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--a);
  box-shadow: 0 0 0.6rem color-mix(in srgb, var(--a) 45%, transparent);
  transition: transform 0.15s;
}

.pin:hover .pin-head { transform: scale(1.45); }
.pin:hover { z-index: 99 !important; }

/* hover popup */
.pin-pop {
  order: 1;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -0.45rem);
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--surface);
  box-shadow: 0 12px 30px -14px rgb(0 0 0 / 0.6);
  font-size: 0.82rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
}

.pin-pop time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 0.4rem;
}

.pin:hover .pin-pop { opacity: 1; visibility: visible; }

/* keep popups inside the timeline near its ends */
.pin.edge-l .pin-pop { left: 0; transform: translate(-0.5rem, -0.45rem); }
.pin.edge-r .pin-pop { left: auto; right: 0; transform: translate(0.5rem, -0.45rem); }

.day-empty {
  position: absolute;
  left: 50%;
  bottom: 4.6rem;
  transform: translateX(-50%);
  margin: 0;
  color: var(--faint);
  font-size: 0.85rem;
  font-style: italic;
  letter-spacing: 0.06em;
}

/* ---- Footer ---- */

.colophon {
  margin-top: clamp(3rem, 8vh, 5rem);
  text-align: center;
  color: color-mix(in srgb, var(--faint) 60%, transparent);
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
}

/* ---- Site switcher ----
   A light glass panel pinned top-left, shared in look with the sibling apps
   (oriole / dash). Kept deliberately light and theme-independent so all three
   switchers match; here it is a vertical stack rather than a horizontal pill. */

.site-switcher {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  -webkit-user-select: none;
  user-select: none;
}

.ss-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 3px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 248, 0.88));
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
}

.ss-tab {
  display: block;
  min-width: 5.5rem;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.2px;
  text-align: center;
  color: rgba(60, 60, 67, 0.55);
  text-decoration: none;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.ss-tab:hover:not(.ss-active) {
  color: rgba(30, 30, 35, 0.9);
  background: rgba(0, 0, 0, 0.04);
}

.ss-active {
  color: #1c1c22;
  cursor: default;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Desktop-only, like the sibling apps' switchers. */
@media (max-width: 640px) {
  .site-switcher { display: none; }
}
