/* Base reset & defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-speed: 60s;           /* animation speed (longer = slower) */
  --card-bg: rgba(0, 0, 0, 0.35);
  --card-border: rgba(255, 255, 255, 0.25);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.4;
  color: #fff;
  background: #000; /* fallback while gradient initializes */
  color-scheme: dark light;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated rainbow background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    120deg,
    #ff004c,
    #ff7a00,
    #ffe600,
    #00e55b,
    #00b6ff,
    #7a00ff,
    #ff0099,
    #ff004c
  );
  background-size: 600% 600%;
  animation: rainbowShift var(--bg-speed) ease-in-out infinite;
  /* a touch of blur makes bands softer and more "ambient" */
  filter: saturate(110%) contrast(105%) brightness(105%);
}

@keyframes rainbowShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
    background-position: 50% 50%;
  }
}

/* Header clock card */
.site-header {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 2.5vh, 24px) 16px 0;
}

.clock {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.clock .dot {
  opacity: 0.8;
}

.date {
  white-space: nowrap;
}

.time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Layout padding for optional page content */
.content {
  min-height: calc(100dvh - 80px);
  padding: 24px;
}

/* Small screens */
@media (max-width: 420px) {
  .clock {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
  .clock .dot { display: none; }
}
